linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mac80211/debugfs: Convert to kstrou8_from_user
@ 2011-06-07 20:36 Peter Huewe
  2011-08-28 19:52 ` Peter Hüwe
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Huewe @ 2011-06-07 20:36 UTC (permalink / raw)
  To: Johannes Berg
  Cc: John W. Linville, David S. Miller, linux-wireless, netdev,
	linux-kernel, kernel-janitors, Peter Huewe

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 <peterhuewe@gmx.de>
---
 net/mac80211/debugfs.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 186e02f..267ed45 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;
-- 
1.7.3.4


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

* Re: [PATCH] net/mac80211/debugfs: Convert to kstrou8_from_user
  2011-06-07 20:36 [PATCH] net/mac80211/debugfs: Convert to kstrou8_from_user Peter Huewe
@ 2011-08-28 19:52 ` Peter Hüwe
  2011-08-30 17:50   ` John W. Linville
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Hüwe @ 2011-08-28 19:52 UTC (permalink / raw)
  To: Johannes Berg
  Cc: John W. Linville, David S. Miller, linux-wireless, netdev,
	linux-kernel, kernel-janitors

Am Dienstag 07 Juni 2011, 22:36:14 schrieb Peter Huewe:
> 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 <peterhuewe@gmx.de>

Any updates on this one?
Still applies to the latest linus' tree

Thanks,
Peter

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

* Re: [PATCH] net/mac80211/debugfs: Convert to kstrou8_from_user
  2011-08-28 19:52 ` Peter Hüwe
@ 2011-08-30 17:50   ` John W. Linville
  0 siblings, 0 replies; 3+ messages in thread
From: John W. Linville @ 2011-08-30 17:50 UTC (permalink / raw)
  To: Peter Hüwe
  Cc: Johannes Berg, David S. Miller, linux-wireless, netdev,
	linux-kernel, kernel-janitors

On Sun, Aug 28, 2011 at 09:52:31PM +0200, Peter Hüwe wrote:
> Am Dienstag 07 Juni 2011, 22:36:14 schrieb Peter Huewe:
> > 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 <peterhuewe@gmx.de>
> 
> Any updates on this one?
> Still applies to the latest linus' tree

I merged it to wireless-next yesterday.

Thanks for the reminder!

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

end of thread, other threads:[~2011-08-30 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07 20:36 [PATCH] net/mac80211/debugfs: Convert to kstrou8_from_user Peter Huewe
2011-08-28 19:52 ` Peter Hüwe
2011-08-30 17:50   ` John W. Linville

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