devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] hwmon/max6697: fix memset size in max6697_init_chip()
@ 2013-01-15  6:53 Dan Carpenter
       [not found] ` <20130115065308.GA899-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-01-15  6:53 UTC (permalink / raw)
  To: Jean Delvare
  Cc: devicetree-discuss, kernel-janitors, Rob Herring, lm-sensors,
	Grant Likely

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c
index a1c8c0a..d229cc7 100644
--- a/drivers/hwmon/max6697.c
+++ b/drivers/hwmon/max6697.c
@@ -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;
 	}

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] hwmon/max6697: fix memset size in max6697_init_chip()
       [not found] ` <20130115065308.GA899-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2013-01-15 10:54   ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2013-01-15 10:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	lm-sensors-GZX6beZjE8VD60Wz+7aTrA, Jean Delvare

On Tue, Jan 15, 2013 at 09:53:08AM +0300, Dan Carpenter wrote:
> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> 
Hi Dan,

Thanks a lot!

Guenter

> diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c
> index a1c8c0a..d229cc7 100644
> --- a/drivers/hwmon/max6697.c
> +++ b/drivers/hwmon/max6697.c
> @@ -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;
>  	}
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-15 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15  6:53 [patch] hwmon/max6697: fix memset size in max6697_init_chip() Dan Carpenter
     [not found] ` <20130115065308.GA899-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2013-01-15 10:54   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).