diff options
author | Nathan Chancellor <natechancellor@gmail.com> | 2019-07-09 16:05:53 -0700 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-07-10 13:56:35 -0300 |
commit | 4d2b8517ba1f3aba9a952ebf153ec972a127c80c (patch) | |
tree | cb90996385b9a7483855a1b3780b34189fa1a5cd /scripts/check_extable.sh | |
parent | d8d9ec7dc5abbb3f11d866e983c4984f5c2de9d6 (diff) | |
download | linux-4d2b8517ba1f3aba9a952ebf153ec972a127c80c.tar.bz2 |
IB/rdmavt: Fix variable shadowing issue in rvt_create_cq
clang warns:
drivers/infiniband/sw/rdmavt/cq.c:260:7: warning: variable 'err' is used
uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
if (err)
^~~
drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs
here
return err;
^~~
drivers/infiniband/sw/rdmavt/cq.c:260:3: note: remove the 'if' if its
condition is always false
if (err)
^~~~~~~~
drivers/infiniband/sw/rdmavt/cq.c:253:7: warning: variable 'err' is used
uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
if (!cq->ip) {
^~~~~~~
drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs
here
return err;
^~~
drivers/infiniband/sw/rdmavt/cq.c:253:3: note: remove the 'if' if its
condition is always false
if (!cq->ip) {
^~~~~~~~~~~~~~
drivers/infiniband/sw/rdmavt/cq.c:211:9: note: initialize the variable
'err' to silence this warning
int err;
^
= 0
2 warnings generated.
The function scoped err variable is uninitialized when the flow jumps into
the if statement. The if scoped err variable shadows the function scoped
err variable, preventing the err assignments within the if statement to be
reflected at the function level, which will cause uninitialized use when
the goto statements are taken.
Just remove the if scoped err declaration so that there is only one copy
of the err variable for this function.
Fixes: 239b0e52d8aa ("IB/hfi1: Move rvt_cq_wc struct into uapi directory")
Link: https://github.com/ClangBuiltLinux/linux/issues/594
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'scripts/check_extable.sh')
0 files changed, 0 insertions, 0 deletions