提交 158ca932 编写于 作者: D Dan Carpenter 提交者: Zheng Zengkai

net: hns3: fix a double shift bug

mainline inclusion
from mainline-master
commit 956c3ae4
category: bugfix
bugzilla: 173966
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=956c3ae411b2746c5018e0454909eb8c662b31ef

----------------------------------------------------------------------

These flags are used to set and test bits like this:

	if (!test_bit(HCLGE_PTP_FLAG_TX_EN, &ptp->flags) ||

The issue is that test_bit() takes a bit number like 1, but we are
passing BIT(1) instead and it's testing BIT(BIT(1)).  This does not
cause a problem because it is always done consistently and the bit
values are very small.

Fixes: 0bf5eb78 ("net: hns3: add support for PTP")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Reviewed-by: NYongxin Li <liyongxin1@huawei.com>
Signed-off-by: NJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 0e093eb7
......@@ -43,9 +43,9 @@
#define HCLGE_PTP_SEC_H_OFFSET 32u
#define HCLGE_PTP_SEC_L_MASK GENMASK(31, 0)
#define HCLGE_PTP_FLAG_EN BIT(0)
#define HCLGE_PTP_FLAG_TX_EN BIT(1)
#define HCLGE_PTP_FLAG_RX_EN BIT(2)
#define HCLGE_PTP_FLAG_EN 0
#define HCLGE_PTP_FLAG_TX_EN 1
#define HCLGE_PTP_FLAG_RX_EN 2
struct hclge_ptp {
struct hclge_dev *hdev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册