linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: verify ieee80211_key_replace() arguments
@ 2013-10-29  9:02 Johannes Berg
  2013-11-06 11:01 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2013-10-29  9:02 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

There's no code calling ieee80211_key_replace() with both
arguments NULL and it wouldn't make sense, but in the
interest of maintainability add a warning for it. As a
side effect, this also shuts up a smatch warning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/key.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 3e51dd7..ab84680 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -260,6 +260,10 @@ static void ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
 	int idx;
 	bool defunikey, defmultikey, defmgmtkey;
 
+	/* caller must provide at least one old/new */
+	if (WARN_ON(!new && !old))
+		return;
+
 	if (new)
 		list_add_tail(&new->list, &sdata->key_list);
 
-- 
1.8.4.rc3


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

* Re: [PATCH] mac80211: verify ieee80211_key_replace() arguments
  2013-10-29  9:02 [PATCH] mac80211: verify ieee80211_key_replace() arguments Johannes Berg
@ 2013-11-06 11:01 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2013-11-06 11:01 UTC (permalink / raw)
  To: linux-wireless

On Tue, 2013-10-29 at 10:02 +0100, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> There's no code calling ieee80211_key_replace() with both
> arguments NULL and it wouldn't make sense, but in the
> interest of maintainability add a warning for it. As a
> side effect, this also shuts up a smatch warning.
> 

Applied

johannes


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

end of thread, other threads:[~2013-11-06 11:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-29  9:02 [PATCH] mac80211: verify ieee80211_key_replace() arguments Johannes Berg
2013-11-06 11:01 ` Johannes Berg

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