Skip to contentSkip to conversation

net: mvpp2: debugfs: fix incorrect bitwise operator

PATCH Applied Gustavo A. R. Silva 3 participants 4 messages Jul 18, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: mvpp2: debugfs: fix incorrect bitwise operator

The use of the | operator always leads to true, which looks rather suspect in this case.

Fix this by using & instead.

Addresses-Coverity-ID: 1471903 ("Wrong operator used")

Fixes dba1d918da02 ("net: mvpp2: debugfs: add entries for classifier flows")
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +1 -1
index 02dfef1..f9744a6 100644
@@ -245,7 +245,7 @@ static int mvpp2_dbgfs_flow_c2_enable_show(struct seq_file *s, void *unused)
 
 	mvpp2_cls_c2_read(port->priv, MVPP22_CLS_C2_RSS_ENTRY(port->id), &c2);
 
-	enabled = !!(c2.attr[2] | MVPP22_CLS_C2_ATTR2_RSS_EN);
+	enabled = !!(c2.attr[2] & MVPP22_CLS_C2_ATTR2_RSS_EN);
 
 	seq_printf(s, "%d\n", enabled);
 
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw

Hi Gustavo,

Quoted 5 lines · On Wed, 18 Jul 2018 08:08:46 -0500 "Gustavo A. R. Silva"…

The use of the | operator always leads to true, which looks rather suspect in this case.

Fix this by using & instead.

Good catch, thanks.

Maxime

#2 lore raw

Hey Maxime,

Quoted 8 lines · Maxime Chevallier

Hi Gustavo,

Quoted 3 lines · On Wed, 18 Jul 2018 08:08:46 -0500 "Gustavo A. R. Silva"…

The use of the | operator always leads to true, which looks rather suspect in this case.

Quoted 7 lines
Quoted 2 lines

Fix this by using & instead.

Good catch, thanks.

Glad to help. :)

Thanks
--
Gustavo

maintainer Applied
#3 lore raw
In reply to Gustavo A. R. Silva

From: "Gustavo A. R. Silva" <[email protected]>
Date: Wed, 18 Jul 2018 08:08:46 -0500

Quoted 8 lines

The use of the | operator always leads to true, which looks rather suspect in this case.

Fix this by using & instead.

Addresses-Coverity-ID: 1471903 ("Wrong operator used")

Fixes dba1d918da02 ("net: mvpp2: debugfs: add entries for classifier flows")

Applied, thanks.