All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wcn36xx: Initialize channel to NULL inside wcn36xx_change_opchannel()
@ 2022-02-19 15:29 Souptick Joarder
  2022-02-21  8:15 ` Loic Poulain
  2022-02-21  9:25 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Souptick Joarder @ 2022-02-19 15:29 UTC (permalink / raw)
  To: loic.poulain, kvalo, davem, kuba, nathan, ndesaulniers, ryan.odonoghue
  Cc: wcn36xx, linux-wireless, netdev, linux-kernel, llvm,
	Souptick Joarder (HPE),
	kernel test robot

From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>

Kernel test robot reported below warning ->
drivers/net/wireless/ath/wcn36xx/main.c:409:7: warning: Branch
condition evaluates to a garbage value
[clang-analyzer-core.uninitialized.Branch]

Also code walk indicates, if channel is not found in first band,
it will break the loop and instead of exit it will go ahead and
assign a garbage value in wcn->channel which looks like a bug.

Initialize channel with NULL should avoid this issue.

Fixes: 	d6f2746691cb ("wcn36xx: Track the band and channel we are tuned to")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 75661d449712..1a06eff07107 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -394,7 +394,7 @@ static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch)
 	struct ieee80211_vif *vif = NULL;
 	struct wcn36xx_vif *tmp;
 	struct ieee80211_supported_band *band;
-	struct ieee80211_channel *channel;
+	struct ieee80211_channel *channel = NULL;
 	unsigned long flags;
 	int i, j;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wcn36xx: Initialize channel to NULL inside wcn36xx_change_opchannel()
  2022-02-19 15:29 [PATCH] wcn36xx: Initialize channel to NULL inside wcn36xx_change_opchannel() Souptick Joarder
@ 2022-02-21  8:15 ` Loic Poulain
  2022-02-21  9:25 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Loic Poulain @ 2022-02-21  8:15 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: kvalo, davem, kuba, nathan, ndesaulniers, ryan.odonoghue,
	wcn36xx, linux-wireless, netdev, linux-kernel, llvm,
	kernel test robot

On Sat, 19 Feb 2022 at 16:29, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
>
> Kernel test robot reported below warning ->
> drivers/net/wireless/ath/wcn36xx/main.c:409:7: warning: Branch
> condition evaluates to a garbage value
> [clang-analyzer-core.uninitialized.Branch]
>
> Also code walk indicates, if channel is not found in first band,
> it will break the loop and instead of exit it will go ahead and
> assign a garbage value in wcn->channel which looks like a bug.
>
> Initialize channel with NULL should avoid this issue.
>
> Fixes:  d6f2746691cb ("wcn36xx: Track the band and channel we are tuned to")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>

Reviewed-by: Loic Poulain <loic.poulain@linaro.org>



> ---
>  drivers/net/wireless/ath/wcn36xx/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index 75661d449712..1a06eff07107 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -394,7 +394,7 @@ static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch)
>         struct ieee80211_vif *vif = NULL;
>         struct wcn36xx_vif *tmp;
>         struct ieee80211_supported_band *band;
> -       struct ieee80211_channel *channel;
> +       struct ieee80211_channel *channel = NULL;
>         unsigned long flags;
>         int i, j;
>
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wcn36xx: Initialize channel to NULL inside wcn36xx_change_opchannel()
  2022-02-19 15:29 [PATCH] wcn36xx: Initialize channel to NULL inside wcn36xx_change_opchannel() Souptick Joarder
  2022-02-21  8:15 ` Loic Poulain
@ 2022-02-21  9:25 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2022-02-21  9:25 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: loic.poulain, davem, kuba, nathan, ndesaulniers, ryan.odonoghue,
	wcn36xx, linux-wireless, netdev, linux-kernel, llvm,
	kernel test robot

Souptick Joarder <jrdr.linux@gmail.com> writes:

> From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>
>
> Kernel test robot reported below warning ->
> drivers/net/wireless/ath/wcn36xx/main.c:409:7: warning: Branch
> condition evaluates to a garbage value
> [clang-analyzer-core.uninitialized.Branch]
>
> Also code walk indicates, if channel is not found in first band,
> it will break the loop and instead of exit it will go ahead and
> assign a garbage value in wcn->channel which looks like a bug.
>
> Initialize channel with NULL should avoid this issue.
>
> Fixes: 	d6f2746691cb ("wcn36xx: Track the band and channel we are tuned to")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
> ---
>  drivers/net/wireless/ath/wcn36xx/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index 75661d449712..1a06eff07107 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -394,7 +394,7 @@ static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch)
>  	struct ieee80211_vif *vif = NULL;
>  	struct wcn36xx_vif *tmp;
>  	struct ieee80211_supported_band *band;
> -	struct ieee80211_channel *channel;
> +	struct ieee80211_channel *channel = NULL;
>  	unsigned long flags;
>  	int i, j;

I have already applied an identical patch from Dan:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=ath-next&id=11e41e2929378df945bf50b95409d93059ad4507

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-21  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-19 15:29 [PATCH] wcn36xx: Initialize channel to NULL inside wcn36xx_change_opchannel() Souptick Joarder
2022-02-21  8:15 ` Loic Poulain
2022-02-21  9:25 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.