diff mbox series

[net-next] net: sched: cls_bpf: use bitwise & rather than logical && on gen_flags

Message ID 20171102200412.16757-1-colin.king@canonical.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net-next] net: sched: cls_bpf: use bitwise & rather than logical && on gen_flags | expand

Commit Message

Colin Ian King Nov. 2, 2017, 8:04 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently gen_flags is being operated on by a logical && operator rather
than a bitwise & operator. This looks incorrect as these should be bit
flag operations. Fix this.

Detected by CoverityScan, CID#1460305 ("Logical vs. bitwise operator")

Fixes: 3f7889c4c79b ("net: sched: cls_bpf: call block callbacks for offload)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/sched/cls_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Borkmann Nov. 2, 2017, 10:20 p.m. UTC | #1
On 11/02/2017 09:04 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently gen_flags is being operated on by a logical && operator rather
> than a bitwise & operator. This looks incorrect as these should be bit
> flag operations. Fix this.
>
> Detected by CoverityScan, CID#1460305 ("Logical vs. bitwise operator")
>
> Fixes: 3f7889c4c79b ("net: sched: cls_bpf: call block callbacks for offload)
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
David Miller Nov. 3, 2017, 6:55 a.m. UTC | #2
From: Colin King <colin.king@canonical.com>
Date: Thu,  2 Nov 2017 20:04:12 +0000

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently gen_flags is being operated on by a logical && operator rather
> than a bitwise & operator. This looks incorrect as these should be bit
> flag operations. Fix this.
> 
> Detected by CoverityScan, CID#1460305 ("Logical vs. bitwise operator")
> 
> Fixes: 3f7889c4c79b ("net: sched: cls_bpf: call block callbacks for offload)
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.
diff mbox series

Patch

diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index 5f701c8670a2..bc3edde1b9d7 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -174,7 +174,7 @@  static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
 		}
 	}
 
-	if (addorrep && skip_sw && !(prog->gen_flags && TCA_CLS_FLAGS_IN_HW))
+	if (addorrep && skip_sw && !(prog->gen_flags & TCA_CLS_FLAGS_IN_HW))
 		return -EINVAL;
 
 	return 0;