linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: Fix use of logical OR in get_new_pps
@ 2020-02-17 20:43 Nathan Chancellor
  2020-02-18 16:33 ` Leon Romanovsky
  2020-02-19 20:46 ` Jason Gunthorpe
  0 siblings, 2 replies; 5+ messages in thread
From: Nathan Chancellor @ 2020-02-17 20:43 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, linux-rdma, linux-kernel, clang-built-linux,
	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")
Link: https://github.com/ClangBuiltLinux/linux/issues/889
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/infiniband/core/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c
index 2b4d80393bd0..b9a36ea244d4 100644
--- a/drivers/infiniband/core/security.c
+++ b/drivers/infiniband/core/security.c
@@ -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)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix use of logical OR in get_new_pps
  2020-02-17 20:43 [PATCH] RDMA/core: Fix use of logical OR in get_new_pps Nathan Chancellor
@ 2020-02-18 16:33 ` Leon Romanovsky
  2020-02-19 20:46 ` Jason Gunthorpe
  1 sibling, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2020-02-18 16:33 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, linux-kernel,
	clang-built-linux

On Mon, Feb 17, 2020 at 01:43:18PM -0700, Nathan Chancellor wrote:
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/889
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/infiniband/core/security.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix use of logical OR in get_new_pps
  2020-02-17 20:43 [PATCH] RDMA/core: Fix use of logical OR in get_new_pps Nathan Chancellor
  2020-02-18 16:33 ` Leon Romanovsky
@ 2020-02-19 20:46 ` Jason Gunthorpe
  2020-02-19 20:50   ` Nathan Chancellor
  1 sibling, 1 reply; 5+ messages in thread
From: Jason Gunthorpe @ 2020-02-19 20:46 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Doug Ledford, Leon Romanovsky, linux-rdma, linux-kernel,
	clang-built-linux

On Mon, Feb 17, 2020 at 01:43:18PM -0700, Nathan Chancellor wrote:
> 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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/889
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/core/security.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix use of logical OR in get_new_pps
  2020-02-19 20:46 ` Jason Gunthorpe
@ 2020-02-19 20:50   ` Nathan Chancellor
  2020-02-19 20:54     ` Jason Gunthorpe
  0 siblings, 1 reply; 5+ messages in thread
From: Nathan Chancellor @ 2020-02-19 20:50 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Doug Ledford, Leon Romanovsky, linux-rdma, linux-kernel,
	clang-built-linux

On Wed, Feb 19, 2020 at 04:46:25PM -0400, Jason Gunthorpe wrote:
> On Mon, Feb 17, 2020 at 01:43:18PM -0700, Nathan Chancellor wrote:
> > 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")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/889
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >  drivers/infiniband/core/security.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RDMA/core: Fix use of logical OR in get_new_pps
  2020-02-19 20:50   ` Nathan Chancellor
@ 2020-02-19 20:54     ` Jason Gunthorpe
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2020-02-19 20:54 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Doug Ledford, Leon Romanovsky, linux-rdma, linux-kernel,
	clang-built-linux

On Wed, Feb 19, 2020 at 01:50:10PM -0700, Nathan Chancellor wrote:
> On Wed, Feb 19, 2020 at 04:46:25PM -0400, Jason Gunthorpe wrote:
> > On Mon, Feb 17, 2020 at 01:43:18PM -0700, Nathan Chancellor wrote:
> > > 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")
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/889
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> > >  drivers/infiniband/core/security.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-19 20:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 20:43 [PATCH] RDMA/core: Fix use of logical OR in get_new_pps Nathan Chancellor
2020-02-18 16:33 ` Leon Romanovsky
2020-02-19 20:46 ` Jason Gunthorpe
2020-02-19 20:50   ` Nathan Chancellor
2020-02-19 20:54     ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).