tmp_suning_uos_patched/drivers/infiniband/sw/rdmavt
Nathan Chancellor 4d2b8517ba 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: 239b0e52d8 ("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>
2019-07-10 13:56:35 -03:00
..
ah.c IB/{rdmavt, hfi1, qib}: Remove AH refcount for UD QPs 2019-06-28 22:34:26 -03:00
ah.h RDMA: Handle AH allocations by IB/core 2019-04-08 13:05:25 -03:00
cq.c IB/rdmavt: Fix variable shadowing issue in rvt_create_cq 2019-07-10 13:56:35 -03:00
cq.h RDMA: Convert CQ allocations to be under core responsibility 2019-06-11 16:39:49 -04:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mad.c RDMA: Mark if destroy address handle is in a sleepable context 2018-12-19 16:28:03 -07:00
mad.h
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mcast.c
mcast.h
mmap.c IB: Pass only ib_udata in function prototypes 2019-04-01 15:00:47 -03:00
mmap.h IB: Pass only ib_udata in function prototypes 2019-04-01 15:00:47 -03:00
mr.c IB/rdmavt: Add trace for map_mr_sg 2019-06-28 22:34:26 -03:00
mr.h IB: Pass uverbs_attr_bundle down ib_x destroy path 2019-04-01 14:57:35 -03:00
pd.c IB: Pass only ib_udata in function prototypes 2019-04-01 15:00:47 -03:00
pd.h IB: Pass only ib_udata in function prototypes 2019-04-01 15:00:47 -03:00
qp.c RDMA/rvt: Do not use a kernel header in the ABI 2019-07-08 13:00:29 -03:00
qp.h IB/hfi1: Move receive work queue struct into uapi directory 2019-06-28 22:32:16 -03:00
rc.c IB/rdmavt: Fracture single lock used for posting and processing RWQEs 2019-06-28 22:32:16 -03:00
srq.c IB/rdmavt: Fracture single lock used for posting and processing RWQEs 2019-06-28 22:32:16 -03:00
srq.h RDMA: Handle SRQ allocations by IB/core 2019-04-08 13:05:25 -03:00
trace_cq.h IB/rdmavt: Add wc_flags and wc_immdata to cq entry trace 2019-01-18 13:48:19 -07:00
trace_mr.h IB/rdmavt: Add trace for map_mr_sg 2019-06-28 22:34:26 -03:00
trace_qp.h IB/rdmavt: Fix ab/ba include issues 2019-04-24 11:31:49 -03:00
trace_rc.h IB/rdmavt: Fix ab/ba include issues 2019-04-24 11:31:49 -03:00
trace_rvt.h
trace_tx.h IB/rdmavt: Fix ab/ba include issues 2019-04-24 11:31:49 -03:00
trace.c
trace.h
vt.c RDMA: Convert CQ allocations to be under core responsibility 2019-06-11 16:39:49 -04:00
vt.h IB/{hfi1, qib, rdmavt}: Put qp in error state when cq is full 2019-06-28 22:34:26 -03:00