Skip to contentSkip to conversation

hwmon/max6697: fix memset size in max6697_init_chip()

PATCH In review Dan Carpenter 2 participants 2 messages Jan 15, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon/max6697: fix memset size in max6697_init_chip()

sizeof(p) was intended instead of sizeof(data). data is a pointer and p is a 7 character struct. It probably doesn't make a difference most of the time, but it could result in using uninitialized data.

drivers/hwmon/max6697.c +1 -1
index a1c8c0a..d229cc7 100644
@@ -474,7 +474,7 @@ static int max6697_init_chip(struct i2c_client *client)
 		return 0;
 
 	if (!pdata || client->dev.of_node) {
-		memset(&p, 0, sizeof(data));
+		memset(&p, 0, sizeof(p));
 		max6697_get_config_of(client->dev.of_node, &p);
 		pdata = &p;
 	}

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#2 lore raw
Quoted 6 lines · Dan Carpenter

sizeof(p) was intended instead of sizeof(data). data is a pointer and p is a 7 character struct. It probably doesn't make a difference most of the time, but it could result in using uninitialized data.

Hi Dan,

Thanks a lot!

Guenter

Quoted 14 lines
drivers/hwmon/max6697.c +1 -1
index a1c8c0a..d229cc7 100644
@@ -474,7 +474,7 @@ static int max6697_init_chip(struct i2c_client *client)
 		return 0;
 
 	if (!pdata || client->dev.of_node) {
-		memset(&p, 0, sizeof(data));
+		memset(&p, 0, sizeof(p));
 		max6697_get_config_of(client->dev.of_node, &p);
 		pdata = &p;
 	}