[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190410180007.4255ee21@mschwideX1>
Date: Wed, 10 Apr 2019 18:00:07 +0200
From: Martin Schwidefsky <schwidefsky@...ibm.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Heiko Carstens <heiko.carstens@...ibm.com>,
Julian Wiedmann <jwi@...ux.ibm.com>,
Ursula Braun <ubraun@...ux.ibm.com>,
clang-built-linux@...glegroups.com,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nathan Chancellor <natechancellor@...il.com>,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 06/12] s390: ctcm: fix ctcm_new_device error return code
On Mon, 8 Apr 2019 23:26:19 +0200
Arnd Bergmann <arnd@...db.de> wrote:
> clang points out that the return code from this function is
> undefined for one of the error paths:
>
> ../drivers/s390/net/ctcm_main.c:1595:7: warning: variable 'result' is used uninitialized whenever 'if' condition is true
> [-Wsometimes-uninitialized]
> if (priv->channel[direction] == NULL) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../drivers/s390/net/ctcm_main.c:1638:9: note: uninitialized use occurs here
> return result;
> ^~~~~~
> ../drivers/s390/net/ctcm_main.c:1595:3: note: remove the 'if' if its condition is always false
> if (priv->channel[direction] == NULL) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../drivers/s390/net/ctcm_main.c:1539:12: note: initialize the variable 'result' to silence this warning
> int result;
> ^
>
> Make it return -ENODEV here, as in the related failure cases.
> gcc has a known bug in underreporting some of these warnings
> when it has already eliminated the assignment of the return code
> based on some earlier optimization step.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Added to our internal tree for Julian to pick up.
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
Powered by blists - more mailing lists