diff options
Diffstat (limited to 'net/wireless/wext-core.c')
| -rw-r--r-- | net/wireless/wext-core.c | 24 | 
1 files changed, 14 insertions, 10 deletions
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index fdbc23c10d8..c8717c1d082 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c @@ -13,6 +13,7 @@  #include <linux/slab.h>  #include <linux/wireless.h>  #include <linux/uaccess.h> +#include <linux/export.h>  #include <net/cfg80211.h>  #include <net/iw_handler.h>  #include <net/netlink.h> @@ -255,7 +256,7 @@ static const struct iw_ioctl_description standard_ioctl[] = {  		.max_tokens	= sizeof(struct iw_pmksa),  	},  }; -static const unsigned standard_ioctl_num = ARRAY_SIZE(standard_ioctl); +static const unsigned int standard_ioctl_num = ARRAY_SIZE(standard_ioctl);  /*   * Meta-data about all the additional standard Wireless Extension events @@ -305,7 +306,7 @@ static const struct iw_ioctl_description standard_event[] = {  		.max_tokens	= sizeof(struct iw_pmkid_cand),  	},  }; -static const unsigned standard_event_num = ARRAY_SIZE(standard_event); +static const unsigned int standard_event_num = ARRAY_SIZE(standard_event);  /* Size (in bytes) of various events */  static const int event_type_size[] = { @@ -401,7 +402,8 @@ static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,  	r->ifi_flags = dev_get_flags(dev);  	r->ifi_change = 0;	/* Wireless changes don't affect those flags */ -	NLA_PUT_STRING(skb, IFLA_IFNAME, dev->name); +	if (nla_put_string(skb, IFLA_IFNAME, dev->name)) +		goto nla_put_failure;  	return nlh;   nla_put_failure: @@ -427,7 +429,7 @@ void wireless_send_event(struct net_device *	dev,  	int hdr_len;				/* Size of the event header */  	int wrqu_off = 0;			/* Offset in wrqu */  	/* Don't "optimise" the following variable, it will crash */ -	unsigned	cmd_index;		/* *MUST* be unsigned */ +	unsigned int	cmd_index;		/* *MUST* be unsigned */  	struct sk_buff *skb;  	struct nlmsghdr *nlh;  	struct nlattr *nla; @@ -476,13 +478,13 @@ void wireless_send_event(struct net_device *	dev,  	if (descr->header_type == IW_HEADER_TYPE_POINT) {  		/* Check if number of token fits within bounds */  		if (wrqu->data.length > descr->max_tokens) { -			netdev_err(dev, "(WE) : Wireless Event too big (%d)\n", -				   wrqu->data.length); +			netdev_err(dev, "(WE) : Wireless Event (cmd=0x%04X) too big (%d)\n", +				   cmd, wrqu->data.length);  			return;  		}  		if (wrqu->data.length < descr->min_tokens) { -			netdev_err(dev, "(WE) : Wireless Event too small (%d)\n", -				   wrqu->data.length); +			netdev_err(dev, "(WE) : Wireless Event (cmd=0x%04X) too small (%d)\n", +				   cmd, wrqu->data.length);  			return;  		}  		/* Calculate extra_len - extra is NULL for restricted events */ @@ -779,8 +781,10 @@ static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd,  		if (cmd == SIOCSIWENCODEEXT) {  			struct iw_encode_ext *ee = (void *) extra; -			if (iwp->length < sizeof(*ee) + ee->key_len) -				return -EFAULT; +			if (iwp->length < sizeof(*ee) + ee->key_len) { +				err = -EFAULT; +				goto out; +			}  		}  	}  | 
