Skip to contentSkip to conversation

nl80211: Allocate array of pointers for nla_parse

PATCH In review Marcus Better 2 participants 2 messages Jan 16, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nl80211: Allocate array of pointers for nla_parse

The code allocates an array of struct nlattr, but it seems to me that it should allocate an array of pointers.

net/wireless/nl80211.c +1 -1
@@ -843,7 +843,7 @@ static int nl80211_initiate_scan(struct sk_buff *skb, struct genl_info *info)
 
 		channels = kmalloc(count * sizeof(struct scan_channel),
 				   GFP_KERNEL);
-		tb = kmalloc((NL80211_ATTR_MAX+1) * sizeof(struct nlattr),
+		tb = kmalloc((NL80211_ATTR_MAX+1) * sizeof(struct nlattr *),
 			     GFP_KERNEL);
 
 		count = 0;
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Marcus Better

The code allocates an array of struct nlattr, but it seems to me that it should allocate an array of pointers.

Yup.

Quoted 11 lines
net/wireless/nl80211.c +1 -1
@@ -843,7 +843,7 @@ static int nl80211_initiate_scan(struct sk_buff *skb, struct genl_info *info)
 
 		channels = kmalloc(count * sizeof(struct scan_channel),
 				   GFP_KERNEL);
-		tb = kmalloc((NL80211_ATTR_MAX+1) * sizeof(struct nlattr),
+		tb = kmalloc((NL80211_ATTR_MAX+1) * sizeof(struct nlattr *),
 			     GFP_KERNEL);
 
 		count = 0;