Thread (19 messages) 19 messages, 6 authors, 2017-09-03

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

From: Joe Perches <joe@perches.com>
Date: 2017-09-03 15:07:56
Also in: lkml

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:
quoted
On Thu, 2017-08-31 at 09:40 -0700, Joe Perches wrote:
quoted
On Thu, 2017-08-31 at 17:44 +0200, Greg Kroah-Hartman wrote:
quoted
4.9-stable review patch.  If anyone has any objections, please let me know.
[]
quoted
quoted
quoted
+++ 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));
quoted
quoted
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];
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help