Subject: Re: [PATCH 06/11] brcmfmac: sdio: Fix undefined behavior due to shift overflowing the constant

From: Kalle Valo <[email-masked]>
Date: Tue, 05 Apr 2022 18:25:30 +0300

+ linux-wireless

Borislav Petkov <[email-masked]> writes:

> From: Borislav Petkov <[email-masked]>
>
> Fix:
>
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_drivestrengthinit’:
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3798:2: error: case label does not reduce to an integer constant
>     case SDIOD_DRVSTR_KEY(BRCM_CC_43143_CHIP_ID, 17):
>     ^~~~
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:3809:2: error: case label does not reduce to an integer constant
>     case SDIOD_DRVSTR_KEY(BRCM_CC_43362_CHIP_ID, 13):
>     ^~~~
>
> 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: Arend van Spriel <[email-masked]>
> Cc: Franky Lin <[email-masked]>
> Cc: Hante Meuleman <[email-masked]>
> Cc: Kalle Valo <[email-masked]>
> Cc: "David S. Miller" <[email-masked]>
> Cc: Jakub Kicinski <[email-masked]>
> Cc: [email-masked]
> Cc: [email-masked]
> ---
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> index ba3c159111d3..d78ccc223709 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
> @@ -557,7 +557,7 @@ enum brcmf_sdio_frmtype {
>  	BRCMF_SDIO_FT_SUB,
>  };
>  
> -#define SDIOD_DRVSTR_KEY(chip, pmu)     (((chip) << 16) | (pmu))
> +#define SDIOD_DRVSTR_KEY(chip, pmu)     (((unsigned int)(chip) << 16) | (pmu))

Via which tree is this going? I assume not the wireless tree, so:

Acked-by: Kalle Valo <[email-masked]>

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches