Subject: [PATCH 5.4 29/62] mt76: Fix undefined behavior due to shift overflowing the constant

From: Greg Kroah-Hartman <[email-masked]>
Date: Tue, 26 Apr 2022 10:21:09 +0200

From: Borislav Petkov <[email-masked]>

[ Upstream commit dbc2b1764734857d68425468ffa8486e97ab89df ]

Fix:

  drivers/net/wireless/mediatek/mt76/mt76x2/pci.c: In function ‘mt76x2e_probe’:
  ././include/linux/compiler_types.h:352:38: error: call to ‘__compiletime_assert_946’ \
	declared with attribute error: FIELD_PREP: mask is not constant
    _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)

See https://lore.kernel.org/r/[email-masked] for the gory
details as to why it triggers with older gccs only.

Signed-off-by: Borislav Petkov <[email-masked]>
Cc: Felix Fietkau <[email-masked]>
Cc: Lorenzo Bianconi <[email-masked]>
Cc: Ryder Lee <[email-masked]>
Cc: Shayne Chen <[email-masked]>
Cc: Sean Wang <[email-masked]>
Cc: Kalle Valo <[email-masked]>
Cc: "David S. Miller" <[email-masked]>
Cc: Jakub Kicinski <[email-masked]>
Cc: [email-masked]
Cc: [email-masked]
Signed-off-by: Kalle Valo <[email-masked]>
Link: https://lore.kernel.org/r/[email-masked]
Signed-off-by: Sasha Levin <[email-masked]>
---
 drivers/net/wireless/mediatek/mt76/mt76x2/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
index cf611d1b817c..e6d7646a0d9c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci.c
@@ -76,7 +76,7 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	mt76_rmw_field(dev, 0x15a10, 0x1f << 16, 0x9);
 
 	/* RG_SSUSB_G1_CDR_BIC_LTR = 0xf */
-	mt76_rmw_field(dev, 0x15a0c, 0xf << 28, 0xf);
+	mt76_rmw_field(dev, 0x15a0c, 0xfU << 28, 0xf);
 
 	/* RG_SSUSB_CDR_BR_PE1D = 0x3 */
 	mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3);
-- 
2.35.1