netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] wireless/nl80211: fix wdev_id may be used uninitialized
@ 2021-03-12 16:36 Jarod Wilson
  2021-03-12 21:03 ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: Jarod Wilson @ 2021-03-12 16:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jarod Wilson, Johannes Berg, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev

Build currently fails with -Werror=maybe-uninitialized set:

net/wireless/nl80211.c: In function '__cfg80211_wdev_from_attrs':
net/wireless/nl80211.c:124:44: error: 'wdev_id' may be used
uninitialized in this function [-Werror=maybe-uninitialized]

Easy fix is to just initialize wdev_id to 0, since it's value doesn't
otherwise matter unless have_wdev_id is true.

Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver")
CC: Johannes Berg <johannes@sipsolutions.net>
CC: "David S. Miller" <davem@davemloft.net>
CC: Jakub Kicinski <kuba@kernel.org>
CC: linux-wireless@vger.kernel.org
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 521d36bb0803..a157783760c7 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -70,7 +70,7 @@ __cfg80211_wdev_from_attrs(struct cfg80211_registered_device *rdev,
 	struct wireless_dev *result = NULL;
 	bool have_ifidx = attrs[NL80211_ATTR_IFINDEX];
 	bool have_wdev_id = attrs[NL80211_ATTR_WDEV];
-	u64 wdev_id;
+	u64 wdev_id = 0;
 	int wiphy_idx = -1;
 	int ifidx = -1;
 
-- 
2.29.2


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

* Re: [PATCH net] wireless/nl80211: fix wdev_id may be used uninitialized
  2021-03-12 16:36 [PATCH net] wireless/nl80211: fix wdev_id may be used uninitialized Jarod Wilson
@ 2021-03-12 21:03 ` Kalle Valo
  2021-03-15 18:20   ` Jarod Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2021-03-12 21:03 UTC (permalink / raw)
  To: Jarod Wilson
  Cc: linux-kernel, Johannes Berg, David S. Miller, Jakub Kicinski,
	linux-wireless, netdev

Jarod Wilson <jarod@redhat.com> writes:

> Build currently fails with -Werror=maybe-uninitialized set:
>
> net/wireless/nl80211.c: In function '__cfg80211_wdev_from_attrs':
> net/wireless/nl80211.c:124:44: error: 'wdev_id' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]

Really, build fails? Is -Werror enabled by default now? I hope not.

-- 
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

* Re: [PATCH net] wireless/nl80211: fix wdev_id may be used uninitialized
  2021-03-12 21:03 ` Kalle Valo
@ 2021-03-15 18:20   ` Jarod Wilson
  0 siblings, 0 replies; 3+ messages in thread
From: Jarod Wilson @ 2021-03-15 18:20 UTC (permalink / raw)
  To: Kalle Valo
  Cc: LKML, Johannes Berg, David S. Miller, Jakub Kicinski,
	linux-wireless, Netdev

On Fri, Mar 12, 2021 at 4:04 PM Kalle Valo <kvalo@codeaurora.org> wrote:
>
> Jarod Wilson <jarod@redhat.com> writes:
>
> > Build currently fails with -Werror=maybe-uninitialized set:
> >
> > net/wireless/nl80211.c: In function '__cfg80211_wdev_from_attrs':
> > net/wireless/nl80211.c:124:44: error: 'wdev_id' may be used
> > uninitialized in this function [-Werror=maybe-uninitialized]
>
> Really, build fails? Is -Werror enabled by default now? I hope not.

Don't think so. But we (Red Hat) build all our kernels with a fair
amount of extra error-checking enabled.

-- 
Jarod Wilson
jarod@redhat.com


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

end of thread, other threads:[~2021-03-15 18:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 16:36 [PATCH net] wireless/nl80211: fix wdev_id may be used uninitialized Jarod Wilson
2021-03-12 21:03 ` Kalle Valo
2021-03-15 18:20   ` Jarod Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).