linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mvpp2: debugfs: fix incorrect bitwise operator
@ 2018-07-18 13:08 Gustavo A. R. Silva
  2018-07-18 14:09 ` Maxime Chevallier
  2018-07-18 17:56 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-07-18 13:08 UTC (permalink / raw)
  To: Maxime Chevallier, David S. Miller
  Cc: netdev, linux-kernel, 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.

Addresses-Coverity-ID: 1471903 ("Wrong operator used")
Fixes: dba1d918da02 ("net: mvpp2: debugfs: add entries for classifier flows")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
index 02dfef1..f9744a6 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c
@@ -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);
 
-- 
2.7.4


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

* Re: [PATCH] net: mvpp2: debugfs: fix incorrect bitwise operator
  2018-07-18 13:08 [PATCH] net: mvpp2: debugfs: fix incorrect bitwise operator Gustavo A. R. Silva
@ 2018-07-18 14:09 ` Maxime Chevallier
  2018-07-18 14:32   ` Gustavo A. R. Silva
  2018-07-18 17:56 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Maxime Chevallier @ 2018-07-18 14:09 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: David S. Miller, netdev, linux-kernel

Hi Gustavo,

On Wed, 18 Jul 2018 08:08:46 -0500
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:

>The use of the | operator always leads to true, which looks rather
>suspect in this case.
>
>Fix this by using & instead.
>

Acked-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Good catch, thanks.

Maxime

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

* Re: [PATCH] net: mvpp2: debugfs: fix incorrect bitwise operator
  2018-07-18 14:09 ` Maxime Chevallier
@ 2018-07-18 14:32   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-07-18 14:32 UTC (permalink / raw)
  To: Maxime Chevallier; +Cc: David S. Miller, netdev, linux-kernel

Hey Maxime,

On 07/18/2018 09:09 AM, Maxime Chevallier wrote:
> Hi Gustavo,
> 
> On Wed, 18 Jul 2018 08:08:46 -0500
> "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> 
>> The use of the | operator always leads to true, which looks rather
>> suspect in this case.
>>
>> Fix this by using & instead.
>>
> 
> Acked-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> 
> Good catch, thanks.
> 

Glad to help. :)

Thanks
--
Gustavo

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

* Re: [PATCH] net: mvpp2: debugfs: fix incorrect bitwise operator
  2018-07-18 13:08 [PATCH] net: mvpp2: debugfs: fix incorrect bitwise operator Gustavo A. R. Silva
  2018-07-18 14:09 ` Maxime Chevallier
@ 2018-07-18 17:56 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2018-07-18 17:56 UTC (permalink / raw)
  To: gustavo; +Cc: maxime.chevallier, netdev, linux-kernel

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Wed, 18 Jul 2018 08:08:46 -0500

> 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")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Applied, thanks.

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

end of thread, other threads:[~2018-07-18 17:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18 13:08 [PATCH] net: mvpp2: debugfs: fix incorrect bitwise operator Gustavo A. R. Silva
2018-07-18 14:09 ` Maxime Chevallier
2018-07-18 14:32   ` Gustavo A. R. Silva
2018-07-18 17:56 ` David Miller

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).