diff mbox series

brcmfmac: Fix incorrect type assignments for keep-alive

Message ID 1638953708-29192-1-git-send-email-loic.poulain@linaro.org (mailing list archive)
State Accepted
Commit 78da5cca6ece7a77879d612ffa1fbc05635182ab
Delegated to: Kalle Valo
Headers show
Series brcmfmac: Fix incorrect type assignments for keep-alive | expand

Commit Message

Loic Poulain Dec. 8, 2021, 8:55 a.m. UTC
cpu_to_le16 has been used for all keep-alive fields, but 'perdio_msec'
is a 32-bit field and 'keep_alive_id' a 8-bit one. Fix that.

Fixes: 7a6cfe28ae3e ("brcmfmac:  Configure keep-alive packet on suspend")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Arend van Spriel Dec. 8, 2021, 1:37 p.m. UTC | #1
On 12/8/2021 9:55 AM, Loic Poulain wrote:
> cpu_to_le16 has been used for all keep-alive fields, but 'perdio_msec'
> is a 32-bit field and 'keep_alive_id' a 8-bit one. Fix that.
> 
> Fixes: 7a6cfe28ae3e ("brcmfmac:  Configure keep-alive packet on suspend")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> index 1679361..ba52318 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> @@ -3908,9 +3908,9 @@ static int brcmf_keepalive_start(struct brcmf_if *ifp, unsigned int interval)

missed it in original patch, but prefer u32 typed.

>   
>   	/* Configure Null function/data keepalive */
>   	kalive.version = cpu_to_le16(1);
> -	kalive.period_msec = cpu_to_le16(interval * MSEC_PER_SEC);
> +	kalive.period_msec = cpu_to_le32(interval * MSEC_PER_SEC);

should we check whether multiplication (interval * MSEC_PER_SEC) does 
not overflow 32 bits? The only caller now uses 30 as interval so that is 
fine.

Regards,
Arend
Kalle Valo Dec. 13, 2021, 6:57 p.m. UTC | #2
Loic Poulain <loic.poulain@linaro.org> wrote:

> cpu_to_le16 has been used for all keep-alive fields, but 'perdio_msec'
> is a 32-bit field and 'keep_alive_id' a 8-bit one. Fix that.
> 
> Fixes: 7a6cfe28ae3e ("brcmfmac:  Configure keep-alive packet on suspend")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

Patch applied to wireless-drivers-next.git, thanks.

78da5cca6ece brcmfmac: Fix incorrect type assignments for keep-alive
Kalle Valo Dec. 13, 2021, 7:04 p.m. UTC | #3
Kalle Valo <kvalo@kernel.org> writes:

> Loic Poulain <loic.poulain@linaro.org> wrote:
>
>> cpu_to_le16 has been used for all keep-alive fields, but 'perdio_msec'
>> is a 32-bit field and 'keep_alive_id' a 8-bit one. Fix that.
>> 
>> Fixes: 7a6cfe28ae3e ("brcmfmac:  Configure keep-alive packet on suspend")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
>
> Patch applied to wireless-drivers-next.git, thanks.
>
> 78da5cca6ece brcmfmac: Fix incorrect type assignments for keep-alive

Actually the fixes tag was incorrect, I fixed it but the commit id changed:

3db30b790289 brcmfmac: Fix incorrect type assignments for keep-alive

The error was:

In commit

  78da5cca6ece ("brcmfmac: Fix incorrect type assignments for keep-alive")

Fixes tag

  Fixes: 7a6cfe28ae3e ("brcmfmac:  Configure keep-alive packet on suspend")

has these problem(s):

  - Subject does not match target commit subject
      Just use
           git log -1 --format='Fixes: %h ("%s")'
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 1679361..ba52318 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -3908,9 +3908,9 @@  static int brcmf_keepalive_start(struct brcmf_if *ifp, unsigned int interval)
 
 	/* Configure Null function/data keepalive */
 	kalive.version = cpu_to_le16(1);
-	kalive.period_msec = cpu_to_le16(interval * MSEC_PER_SEC);
+	kalive.period_msec = cpu_to_le32(interval * MSEC_PER_SEC);
 	kalive.len_bytes = cpu_to_le16(0);
-	kalive.keep_alive_id = cpu_to_le16(0);
+	kalive.keep_alive_id = 0;
 
 	ret = brcmf_fil_iovar_data_set(ifp, "mkeep_alive", &kalive, sizeof(kalive));
 	if (ret)