From: Johannes Berg Date: Tue, 29 Oct 2013 09:00:08 +0000 (+0100) Subject: mac80211: verify ieee80211_key_replace() arguments X-Git-Tag: accepted/tizen/common/20141203.182822~719^2~3^2^2~274 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5282c3ba4c5a24b2ab45a6742f9ab01a3d90c167;p=platform%2Fkernel%2Flinux-arm64.git mac80211: verify ieee80211_key_replace() arguments 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 --- 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);