Skip to content

Commit 4ca501d

Browse files
nathanchancejgunthorpe
authored andcommitted
RDMA/core: Fix use of logical OR in get_new_pps
Clang warns: ../drivers/infiniband/core/security.c:351:41: warning: converting the enum constant to a boolean [-Wint-in-bool-context] if (!(qp_attr_mask & (IB_QP_PKEY_INDEX || IB_QP_PORT)) && qp_pps) { ^ 1 warning generated. A bitwise OR should have been used instead. Fixes: 1dd0178 ("RDMA/core: Fix protection fault in get_pkey_idx_qp_list") Link: https://lore.kernel.org/r/[email protected] Link: ClangBuiltLinux#889 Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent e410331 commit 4ca501d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/infiniband/core/security.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static struct ib_ports_pkeys *get_new_pps(const struct ib_qp *qp,
348348
if ((qp_attr_mask & IB_QP_PKEY_INDEX) && (qp_attr_mask & IB_QP_PORT))
349349
new_pps->main.state = IB_PORT_PKEY_VALID;
350350

351-
if (!(qp_attr_mask & (IB_QP_PKEY_INDEX || IB_QP_PORT)) && qp_pps) {
351+
if (!(qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) && qp_pps) {
352352
new_pps->main.port_num = qp_pps->main.port_num;
353353
new_pps->main.pkey_index = qp_pps->main.pkey_index;
354354
if (qp_pps->main.state != IB_PORT_PKEY_NOT_VALID)

0 commit comments

Comments
 (0)