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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2017-09-03 at 14:32 +0200, Christian Lamparter wrote:
> On Saturday, September 2, 2017 8:51:01 AM CEST Joe Perches wrote:
> > 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.
[]
> > > > +++ 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.
>  
> hm?
> 
> Please, just look again at [0]:
[]
> yes: "curve_data" is a pointer.

Thank you.
My mistake, curve_data here is an array of structs.

> This means that chan->curve_data is 64 bytes in total.

I saw only:

drivers/net/wireless/intersil/p54/p54.h:        struct p54_cal_database *curve_data;

and did not notice

drivers/net/wireless/intersil/p54/lmac.h:       struct p54_pa_curve_data_sample curve_data[8];




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]