lkml.org 
[lkml]   [2017]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4.9 01/12] p54: memset(0) whole array
From
Date
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];

\
 
 \ /
  Last update: 2017-09-03 17:09    [W:0.085 / U:0.576 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site