From: Wolfram Sang Date: Tue, 19 May 2015 16:29:48 +0000 (+0200) Subject: i2c: check for proper length of the reg property X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4c1344f105b626c222ea64669dc6dcfe100ccf3b;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git i2c: check for proper length of the reg property int is vague, let's simply use the type of the variable in question. Signed-off-by: Wolfram Sang Reviewed-by: Simon Horman Signed-off-by: Wolfram Sang --- diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 2a627eb0365b..b8f11b82485c 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1272,7 +1272,7 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, } addr = of_get_property(node, "reg", &len); - if (!addr || (len < sizeof(int))) { + if (!addr || (len < sizeof(*addr))) { dev_err(&adap->dev, "of_i2c: invalid reg on %s\n", node->full_name); return ERR_PTR(-EINVAL);