]> git.baikalelectronics.ru Git - kernel.git/commit
kalmia: avoid potential uninitialized variable use
authorArnd Bergmann <arnd@arndb.de>
Mon, 24 Oct 2016 15:54:18 +0000 (17:54 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Oct 2016 20:27:34 +0000 (16:27 -0400)
commit6c55dec08c6ecd0026c068bc804b608ac693bac8
tree1850cde4f291668d6a54d9fbfbbfba6c2114796c
parentd83cddad8a400d2194d3234ed4bdc430845b5094
kalmia: avoid potential uninitialized variable use

The kalmia_send_init_packet() returns zero or a negative return
code, but gcc has no way of knowing that there cannot be a
positive return code, so it determines that copying the ethernet
address at the end of kalmia_bind() will access uninitialized
data:

drivers/net/usb/kalmia.c: In function ‘kalmia_bind’:
arch/x86/include/asm/string_32.h:78:22: error: ‘*((void *)&ethernet_addr+4)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   *((short *)to + 2) = *((short *)from + 2);
                      ^
drivers/net/usb/kalmia.c:138:5: note: ‘*((void *)&ethernet_addr+4)’ was declared here

This warning is harmless, but for consistency, we should make
the check for the return code match what the driver does everywhere
else and just progate it, which then gets rid of the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/kalmia.c