diff mbox series

[next] net: hns3: fix expression that is currently always true

Message ID 20201215000033.85383-1-colin.king@canonical.com (mailing list archive)
State Accepted
Commit efd5a1584537698220578227e6467638307c2a0b
Delegated to: Netdev Maintainers
Headers show
Series [next] net: hns3: fix expression that is currently always true | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Colin King Dec. 15, 2020, midnight UTC
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(-)

Comments

Huazhong Tan Dec. 15, 2020, 1:34 a.m. UTC | #1
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.
patchwork-bot+netdevbpf@kernel.org Dec. 15, 2020, 4 a.m. UTC | #2
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
diff mbox series

Patch

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;