2014-09-01 11:54:37

by Shakil A Khan

[permalink] [raw]
Subject: [PATCH 2/2] nl80211.c: Fixed the wdev_id being used uninitialized.

Signed-off-by: Shakil A Khan <[email protected]>
---
net/wireless/nl80211.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index df7b133..6cd7df2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -76,7 +76,7 @@ __cfg80211_wdev_from_attrs(struct net *netns, struct nlattr **attrs)
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;

--
1.7.1



2014-09-01 12:33:14

by Shakil A Khan

[permalink] [raw]
Subject: Re: [PATCH 2/2] nl80211.c: Fixed the wdev_id being used uninitialized.

On Monday 01 September 2014 08:07:38 Johannes Berg wrote:
> > + u64 wdev_id = 0;
>
> it's not used uninitialized, NACK.
>
> johannes
>

wdev_id can be used uninitialized if have_wdev_id turns to be false, which may happen if the entry for NL80211_ATTR_WDEV is removed in future. Who knows.

2014-09-01 12:07:47

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/2] nl80211.c: Fixed the wdev_id being used uninitialized.


> + u64 wdev_id = 0;

it's not used uninitialized, NACK.

johannes


2014-09-01 12:42:27

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/2] nl80211.c: Fixed the wdev_id being used uninitialized.

On Mon, 2014-09-01 at 08:33 -0400, Shakil A Khan wrote:
> On Monday 01 September 2014 08:07:38 Johannes Berg wrote:
> > > + u64 wdev_id = 0;
> >
> > it's not used uninitialized, NACK.
> >
> > johannes
> >
>
> wdev_id can be used uninitialized if have_wdev_id turns to be false,
> which may happen if the entry for NL80211_ATTR_WDEV is removed in
> future. Who knows.

In which case the compiler will warn about it. If you were to use a
newer compiler now, you wouldn't see the warning.

johannes