Skip to contentSkip to conversation

build warning in drivers/macintosh/rack-meter.c

DISCUSSION Stephen Rothwell 3 participants 4 messages Mar 16, 2018

lore
Share & tools
lore
#0 lore raw

Hi all,

These warnings have beeen around for a while now;

drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(rdma->buf1, 0, ARRAY_SIZE(rdma->buf1));
^~~~~~
drivers/macintosh/rack-meter.c:158:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(rdma->buf2, 0, ARRAY_SIZE(rdma->buf2));
^~~~~~

Introduced by commit

4f7bef7a9f69 ("drivers: macintosh: rack-meter: fix bogus memsets")

I guess updating to a newer compiler has started generating these.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw

Hi,

Quoted 9 lines · Stephen Rothwell

These warnings have beeen around for a while now;

drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(rdma->buf1, 0, ARRAY_SIZE(rdma->buf1));
^~~~~~
drivers/macintosh/rack-meter.c:158:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(rdma->buf2, 0, ARRAY_SIZE(rdma->buf2));
^~~~~~

Quoted 5 lines

Introduced by commit

4f7bef7a9f69 ("drivers: macintosh: rack-meter: fix bogus memsets")

I guess updating to a newer compiler has started generating these.

Eh, that's really embarrassing. Obviously it should be sizeof(). I can send a fix for this and test on Xserve.

A.

#2 lore raw

Hi Aaro,

Quoted 2 lines · On Fri, 16 Mar 2018 11:37:47 +0200 Aaro Koskinen <[email protected]> wrote:

I can send a fix for this and test on Xserve.

Excellent. (I should send emails about more old warnings :-))

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
In reply to Stephen Rothwell
Quoted 11 lines · Stephen Rothwell

Hi all,

These warnings have beeen around for a while now;

drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(rdma->buf1, 0, ARRAY_SIZE(rdma->buf1));
^~~~~~
drivers/macintosh/rack-meter.c:158:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
memset(rdma->buf2, 0, ARRAY_SIZE(rdma->buf2));
^~~~~~

Quoted 3 lines

Introduced by commit

4f7bef7a9f69 ("drivers: macintosh: rack-meter: fix bogus memsets")

Yep looks like a bug.

Aaro, can you send a patch?

cheers