Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725530

Re: [PATCH 4.9 01/12] p54: memset(0) whole array

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4.9 01/12] p54: memset(0) whole array
Date 2017-09-02 18:00 +0200
Message-ID <uliZY-4Mu-31@gated-at.bofh.it> (permalink)
References <ukzTc-7qZ-5@gated-at.bofh.it> <ukzTc-7qZ-3@gated-at.bofh.it> <ukAPg-81j-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2017-08-31 at 09:40 -0700, Joe Perches wrote:
> On Thu, 2017-08-31 at 17:44 +0200, Greg Kroah-Hartman wrote:
> > 4.9-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Jiri Slaby <jslaby@suse.cz>
> > 
> > commit 6f17581788206444cbbcdbc107498f85e9765e3d upstream.
> > 
> > gcc 7 complains:
> > drivers/net/wireless/intersil/p54/fwio.c: In function 'p54_scan':
> > drivers/net/wireless/intersil/p54/fwio.c:491:4: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
> > 
> > Fix that by passing the correct size to memset.
> > 
> > Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> > Cc: Christian Lamparter <chunkeey@googlemail.com>
> > Cc: Kalle Valo <kvalo@codeaurora.org>
> > Acked-by: Christian Lamparter <chunkeey@googlemail.com>
> > Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> > ---
> >  drivers/net/wireless/intersil/p54/fwio.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > --- a/drivers/net/wireless/intersil/p54/fwio.c
> > +++ b/drivers/net/wireless/intersil/p54/fwio.c
> > @@ -488,7 +488,7 @@ int p54_scan(struct p54_common *priv, u1
> >  
> >  			entry += sizeof(__le16);
> >  			chan->pa_points_per_curve = 8;
> > -			memset(chan->curve_data, 0, sizeof(*chan->curve_data));
> > +			memset(chan->curve_data, 0, sizeof(chan->curve_data));
> >  			memcpy(chan->curve_data, entry,
> >  			       sizeof(struct p54_pa_curve_data_sample) *
> >  			       min((u8)8, curve_data->points_per_channel));
> > 
> 
> Why is this change correct?
> 
> curve_data is a pointer.
> 
> This now clears the sizeof a pointer and not
> the sizeof struct p54_cal_database

So what happens here?
This change seems clearly incorrect.
For all stable versions.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.9 01/12] p54: memset(0) whole array Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-31 17:50 +0200
  Re: [PATCH 4.9 01/12] p54: memset(0) whole array Joe Perches <joe@perches.com> - 2017-08-31 18:50 +0200
    Re: [PATCH 4.9 01/12] p54: memset(0) whole array Joe Perches <joe@perches.com> - 2017-09-02 18:00 +0200
      Re: [PATCH 4.9 01/12] p54: memset(0) whole array Christian Lamparter <chunkeey@googlemail.com> - 2017-09-03 14:40 +0200
        Re: [PATCH 4.9 01/12] p54: memset(0) whole array Joe Perches <joe@perches.com> - 2017-09-03 17:10 +0200

csiph-web