From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <1504197650.2786.38.camel@perches.com> Subject: Re: [PATCH 4.9 01/12] p54: memset(0) whole array From: Joe Perches To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Jiri Slaby , Christian Lamparter , Kalle Valo Date: Thu, 31 Aug 2017 09:40:50 -0700 In-Reply-To: <20170831154238.982008528@linuxfoundation.org> References: <20170831154238.914795784@linuxfoundation.org> <20170831154238.982008528@linuxfoundation.org> Content-Type: text/plain; charset="ISO-8859-1" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: 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 > > 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 > Cc: Christian Lamparter > Cc: Kalle Valo > Acked-by: Christian Lamparter > Signed-off-by: Kalle Valo > Signed-off-by: Greg Kroah-Hartman > > --- > 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