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

4 messages, 3 authors, 2018-03-16 · open the first message on its own page

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

From: Stephen Rothwell <hidden>
Date: 2018-03-16 05:46:45

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.

-- 
Cheers,
Stephen Rothwell

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

From: Aaro Koskinen <aaro.koskinen@iki.fi>
Date: 2018-03-16 09:46:56

Hi,

On Fri, Mar 16, 2018 at 04:46:14PM +1100, Stephen Rothwell wrote:
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.
Eh, that's really embarrassing. Obviously it should be sizeof(). I can send
a fix for this and test on Xserve.

A.

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

From: Stephen Rothwell <hidden>
Date: 2018-03-16 09:51:48

Hi Aaro,

On Fri, 16 Mar 2018 11:37:47 +0200 Aaro Koskinen [off-list ref] wrote:
I can send a fix for this and test on Xserve.
Excellent.  (I should send emails about more old warnings :-))

-- 
Cheers,
Stephen Rothwell

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

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2018-03-16 10:22:38

Stephen Rothwell [off-list ref] writes:
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")
Yep looks like a bug.

Aaro, can you send a patch?

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help