Skip to contentSkip to conversation

RDMA/core: Fix use of logical OR in get_new_pps

PATCH Applied Nathan Chancellor 3 participants 5 messages Feb 17, 2020 – Feb 19, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 1dd017882e01 ("RDMA/core: Fix protection fault in get_pkey_idx_qp_list")
---
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/security.c +1 -1
index 2b4d80393bd0..b9a36ea244d4 100644
@@ -348,7 +348,7 @@ static struct ib_ports_pkeys *get_new_pps(const struct ib_qp *qp,
 	if ((qp_attr_mask & IB_QP_PKEY_INDEX) && (qp_attr_mask & IB_QP_PORT))
 		new_pps->main.state = IB_PORT_PKEY_VALID;
 
-	if (!(qp_attr_mask & (IB_QP_PKEY_INDEX || IB_QP_PORT)) && qp_pps) {
+	if (!(qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) && qp_pps) {
 		new_pps->main.port_num = qp_pps->main.port_num;
 		new_pps->main.pkey_index = qp_pps->main.pkey_index;
 		if (qp_pps->main.state != IB_PORT_PKEY_NOT_VALID)
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Nathan Chancellor

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.

Quoted 9 lines

A bitwise OR should have been used instead.

Fixes 1dd017882e01 ("RDMA/core: Fix protection fault in get_pkey_idx_qp_list")
---
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

#2 lore raw
In reply to Nathan Chancellor
Quoted 10 lines · Nathan Chancellor

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.

Quoted 7 lines
Fixes 1dd017882e01 ("RDMA/core: Fix protection fault in get_pkey_idx_qp_list")
---
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

#3 lore raw
Quoted 19 lines · Jason Gunthorpe
Quoted 10 lines · Nathan Chancellor

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.

Quoted 7 lines
Fixes 1dd017882e01 ("RDMA/core: Fix protection fault in get_pkey_idx_qp_list")
---
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 3 lines

Applied to for-next, thanks

Jason

Shouldn't this go into for-rc since the commit that introduced this was merged in 5.6-rc2? I guess I should have added that after the PATCH in the subject line, I always forget.

Cheers,
Nathan

#4 lore raw
Quoted 19 lines · Nathan Chancellor
Quoted 18 lines · Jason Gunthorpe
Quoted 16 lines · Nathan Chancellor

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 1dd017882e01 ("RDMA/core: Fix protection fault in get_pkey_idx_qp_list")
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Quoted 3 lines

Applied to for-next, thanks

Jason

Shouldn't this go into for-rc since the commit that introduced this was merged in 5.6-rc2? I guess I should have added that after the PATCH in the subject line, I always forget.

Oops, that was a typo, it did go to -rc

[each artisanal 'applied' message is uniquely hand crafted]

Jason