devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
To: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org,
	Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Subject: Re: [patch] hwmon/max6697: fix memset size in max6697_init_chip()
Date: Tue, 15 Jan 2013 02:54:02 -0800	[thread overview]
Message-ID: <20130115105402.GA21765@roeck-us.net> (raw)
In-Reply-To: <20130115065308.GA899-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>

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;
>  	}
> 

      parent reply	other threads:[~2013-01-15 10:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130115105402.GA21765@roeck-us.net \
    --to=linux-0h96xk9xttrk1umjsbkqmq@public.gmane.org \
    --cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=lm-sensors-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).