From b38de31ffa870323c4f6957904303477c88fe905 Mon Sep 17 00:00:00 2001 From: Peter Huewe Date: Tue, 7 Jun 2011 22:36:14 +0200 Subject: net/mac80211/debugfs: Convert to kstrou8_from_user This patch replaces the code for getting an number from a userspace buffer by a simple call to kstrou8_from_user. This makes it easier to read and less error prone. Since the old buffer was only 10 bytes long and the value is masked by a nibble-mask anyway, we don't need to use kstrtoul but rather kstrtou8. Kernel Version: v3.0-rc2 Signed-off-by: Peter Huewe Signed-off-by: John W. Linville --- net/mac80211/debugfs.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'net/mac80211') diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c index 186e02f7cc3..267ed45ef6a 100644 --- a/net/mac80211/debugfs.c +++ b/net/mac80211/debugfs.c @@ -195,20 +195,12 @@ static ssize_t uapsd_queues_write(struct file *file, size_t count, loff_t *ppos) { struct ieee80211_local *local = file->private_data; - unsigned long val; - char buf[10]; - size_t len; + u8 val; int ret; - len = min(count, sizeof(buf) - 1); - if (copy_from_user(buf, user_buf, len)) - return -EFAULT; - buf[len] = '\0'; - - ret = strict_strtoul(buf, 0, &val); - + ret = kstrtou8_from_user(user_buf, count, 0, &val); if (ret) - return -EINVAL; + return ret; if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) return -ERANGE; -- cgit v1.2.3-18-g5258 From 817a53d9866ab4118e2dd17a9ffe80700eac40ac Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Wed, 24 Aug 2011 15:12:41 -0400 Subject: mac80211: refactor skb copy to failq in mesh_path_move_to_queue This seems a bit less awkward... Signed-off-by: John W. Linville --- net/mac80211/mesh_pathtbl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'net/mac80211') diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 3c2bcb2de84..ede4f5242e0 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c @@ -307,14 +307,14 @@ static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, while (num_skbs--) { skb = __skb_dequeue(&failq); - if (copy) + if (copy) { cp_skb = skb_copy(skb, GFP_ATOMIC); + if (cp_skb) + __skb_queue_tail(&failq, cp_skb); + } prepare_for_gate(skb, gate_mpath->dst, gate_mpath); __skb_queue_tail(&gateq, skb); - - if (copy && cp_skb) - __skb_queue_tail(&failq, cp_skb); } spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags); -- cgit v1.2.3-18-g5258