]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: Fix preinitialization of buf_desc in __smc_buf_create()
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 21 Nov 2017 12:23:54 +0000 (13:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Nov 2017 16:33:34 +0000 (01:33 +0900)
commitda075ec5ca21807eb993bdf3be73188442ea6973
tree25c45bf458dbffcd8d7a44be84cda22a258fdd6a
parent7da1b94352dff67a0c22e33ced9488b9b416fd7c
net/smc: Fix preinitialization of buf_desc in __smc_buf_create()

With gcc-4.1.2:

    net/smc/smc_core.c: In function ‘__smc_buf_create’:
    net/smc/smc_core.c:567: warning: ‘bufsize’ may be used uninitialized in this function

Indeed, if the for-loop is never executed, bufsize is used
uninitialized.  In addition, buf_desc is stored for later use, while it
is still a NULL pointer.

Before, error handling was done by checking if buf_desc is non-NULL.
The cleanup changed this to an error check, but forgot to update the
preinitialization of buf_desc to an error pointer.

Update the preinitializatin of buf_desc to fix this.

Fixes: 3201a6594a24ebc8 ("net/smc: cleanup function __smc_buf_create()")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_core.c