netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] net: hns3: fix expression that is currently always true
@ 2020-12-15  0:00 Colin King
  2020-12-15  1:34 ` Huazhong Tan
  2020-12-15  4:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2020-12-15  0:00 UTC (permalink / raw)
  To: Yisen Zhuang, Salil Mehta, David S . Miller, Jakub Kicinski,
	Huazhong Tan, Jian Shen, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The ||  condition in hdev->fd_active_type != HCLGE_FD_ARFS_ACTIVE ||
hdev->fd_active_type != HCLGE_FD_RULE_NONE will always be true because
hdev->fd_active_type cannot be equal to two different values at the same
time. The expression is always true which is not correct. Fix this by
replacing || with && to correct the logic in the expression.

Addresses-Coverity: ("Constant expression result")
Fixes: 0205ec041ec6 ("net: hns3: add support for hw tc offload of tc flower")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 7a164115c845..e6f37f91c489 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -6485,7 +6485,7 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id,
 	 * arfs should not work
 	 */
 	spin_lock_bh(&hdev->fd_rule_lock);
-	if (hdev->fd_active_type != HCLGE_FD_ARFS_ACTIVE ||
+	if (hdev->fd_active_type != HCLGE_FD_ARFS_ACTIVE &&
 	    hdev->fd_active_type != HCLGE_FD_RULE_NONE) {
 		spin_unlock_bh(&hdev->fd_rule_lock);
 		return -EOPNOTSUPP;
-- 
2.29.2


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

* Re: [PATCH][next] net: hns3: fix expression that is currently always true
  2020-12-15  0:00 [PATCH][next] net: hns3: fix expression that is currently always true Colin King
@ 2020-12-15  1:34 ` Huazhong Tan
  2020-12-15  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Huazhong Tan @ 2020-12-15  1:34 UTC (permalink / raw)
  To: Colin King, Yisen Zhuang, Salil Mehta, David S . Miller,
	Jakub Kicinski, Jian Shen, netdev
  Cc: kernel-janitors, linux-kernel


On 2020/12/15 8:00, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> The ||  condition in hdev->fd_active_type != HCLGE_FD_ARFS_ACTIVE ||
> hdev->fd_active_type != HCLGE_FD_RULE_NONE will always be true because
> hdev->fd_active_type cannot be equal to two different values at the same
> time. The expression is always true which is not correct. Fix this by
> replacing || with && to correct the logic in the expression.
>
> Addresses-Coverity: ("Constant expression result")
> Fixes: 0205ec041ec6 ("net: hns3: add support for hw tc offload of tc flower")
> Signed-off-by: Colin Ian King<colin.king@canonical.com>

Reviewed-by: Huazhong Tan <tanhuazhong@huawei.com>

Thanks.




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

* Re: [PATCH][next] net: hns3: fix expression that is currently always true
  2020-12-15  0:00 [PATCH][next] net: hns3: fix expression that is currently always true Colin King
  2020-12-15  1:34 ` Huazhong Tan
@ 2020-12-15  4:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-12-15  4:00 UTC (permalink / raw)
  To: Colin King
  Cc: yisen.zhuang, salil.mehta, davem, kuba, tanhuazhong, shenjian15,
	netdev, kernel-janitors, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Tue, 15 Dec 2020 00:00:33 +0000 you wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The ||  condition in hdev->fd_active_type != HCLGE_FD_ARFS_ACTIVE ||
> hdev->fd_active_type != HCLGE_FD_RULE_NONE will always be true because
> hdev->fd_active_type cannot be equal to two different values at the same
> time. The expression is always true which is not correct. Fix this by
> replacing || with && to correct the logic in the expression.
> 
> [...]

Here is the summary with links:
  - [next] net: hns3: fix expression that is currently always true
    https://git.kernel.org/netdev/net-next/c/efd5a1584537

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2020-12-15  4:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15  0:00 [PATCH][next] net: hns3: fix expression that is currently always true Colin King
2020-12-15  1:34 ` Huazhong Tan
2020-12-15  4:00 ` patchwork-bot+netdevbpf

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