[PATCH] bpf: Simplify the calculation of variables

Subsystems: bpf [general] (safe dynamic programs and tools), the rest

DORMANTno replies LANDED

Landed in mainline as 46ac034f769f on 2021-03-05.

2 messages, 2 authors, 2021-03-03 · open the first message on its own page

[PATCH] bpf: Simplify the calculation of variables

From: Jiapeng Chong <hidden>
Date: 2021-03-03 13:06:27

Fix the following coccicheck warnings:

./tools/bpf/bpf_dbg.c:1201:55-57: WARNING !A || A && B is equivalent to
!A || B.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
---
 tools/bpf/bpf_dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/bpf_dbg.c b/tools/bpf/bpf_dbg.c
index a07dfc4..00e560a 100644
--- a/tools/bpf/bpf_dbg.c
+++ b/tools/bpf/bpf_dbg.c
@@ -1198,7 +1198,7 @@ static int cmd_run(char *num)
 		else
 			return CMD_OK;
 		bpf_reset();
-	} while (pcap_next_pkt() && (!has_limit || (has_limit && ++i < pkts)));
+	} while (pcap_next_pkt() && (!has_limit || (++i < pkts)));
 
 	rl_printf("bpf passes:%u fails:%u\n", pass, fail);
 
-- 
1.8.3.1

Re: [PATCH] bpf: Simplify the calculation of variables

From: Yonghong Song <hidden>
Date: 2021-03-03 13:06:27


On 3/2/21 11:20 PM, Jiapeng Chong wrote:
Fix the following coccicheck warnings:

./tools/bpf/bpf_dbg.c:1201:55-57: WARNING !A || A && B is equivalent to
!A || B.

Reported-by: Abaci Robot <redacted>
Signed-off-by: Jiapeng Chong <redacted>
Acked-by: Yonghong Song <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help