All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Glauber <jang@linux.vnet.ibm.com>
To: Peter Huewe <peterhuewe@gmx.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux390@de.ibm.com, Heiko Carstens <heiko.carstens@de.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	Frank Blaschka <frank.blaschka@de.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] s390/qdio_debug: Use kstrtoul_from_user
Date: Tue, 07 Jun 2011 10:27:48 +0000	[thread overview]
Message-ID: <20110607102748.GA10838@hal> (raw)
In-Reply-To: <1307394474-747-2-git-send-email-peterhuewe@gmx.de>

On Mon, Jun 06, 2011 at 11:07:54PM +0200, Peter Huewe wrote:
> This patch replaces the code for getting an unsigned long from a
> userspace buffer by a simple call to kstroul_from_user.
> This makes it easier to read and less error prone.
> 
> Kernel Version: v3.0-rc2
> 
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>

Acked-by: Jan Glauber <jang@linux.vnet.ibm.com>

> ---
>  drivers/s390/cio/qdio_debug.c |   12 +++---------
>  1 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
> index f8b03a6..0e615cb 100644
> --- a/drivers/s390/cio/qdio_debug.c
> +++ b/drivers/s390/cio/qdio_debug.c
> @@ -188,19 +188,13 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf,
>  	struct qdio_irq *irq_ptr = seq->private;
>  	struct qdio_q *q;
>  	unsigned long val;
> -	char buf[8];
>  	int ret, i;
> 
>  	if (!irq_ptr)
>  		return 0;
> -	if (count >= sizeof(buf))
> -		return -EINVAL;
> -	if (copy_from_user(&buf, ubuf, count))
> -		return -EFAULT;
> -	buf[count] = 0;
> -
> -	ret = strict_strtoul(buf, 10, &val);
> -	if (ret < 0)
> +
> +	ret = kstrtoul_from_user(ubuf, count, 10, &val);
> +	if (ret)
>  		return ret;
> 
>  	switch (val) {
> -- 
> 1.7.3.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

WARNING: multiple messages have this Message-ID (diff)
From: Jan Glauber <jang@linux.vnet.ibm.com>
To: Peter Huewe <peterhuewe@gmx.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux390@de.ibm.com, Heiko Carstens <heiko.carstens@de.ibm.com>,
	"David S. Miller" <davem@davemloft.net>,
	Frank Blaschka <frank.blaschka@de.ibm.com>,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] s390/qdio_debug: Use kstrtoul_from_user
Date: Tue, 7 Jun 2011 12:27:48 +0200	[thread overview]
Message-ID: <20110607102748.GA10838@hal> (raw)
In-Reply-To: <1307394474-747-2-git-send-email-peterhuewe@gmx.de>

On Mon, Jun 06, 2011 at 11:07:54PM +0200, Peter Huewe wrote:
> This patch replaces the code for getting an unsigned long from a
> userspace buffer by a simple call to kstroul_from_user.
> This makes it easier to read and less error prone.
> 
> Kernel Version: v3.0-rc2
> 
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>

Acked-by: Jan Glauber <jang@linux.vnet.ibm.com>

> ---
>  drivers/s390/cio/qdio_debug.c |   12 +++---------
>  1 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/s390/cio/qdio_debug.c b/drivers/s390/cio/qdio_debug.c
> index f8b03a6..0e615cb 100644
> --- a/drivers/s390/cio/qdio_debug.c
> +++ b/drivers/s390/cio/qdio_debug.c
> @@ -188,19 +188,13 @@ static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf,
>  	struct qdio_irq *irq_ptr = seq->private;
>  	struct qdio_q *q;
>  	unsigned long val;
> -	char buf[8];
>  	int ret, i;
> 
>  	if (!irq_ptr)
>  		return 0;
> -	if (count >= sizeof(buf))
> -		return -EINVAL;
> -	if (copy_from_user(&buf, ubuf, count))
> -		return -EFAULT;
> -	buf[count] = 0;
> -
> -	ret = strict_strtoul(buf, 10, &val);
> -	if (ret < 0)
> +
> +	ret = kstrtoul_from_user(ubuf, count, 10, &val);
> +	if (ret)
>  		return ret;
> 
>  	switch (val) {
> -- 
> 1.7.3.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

  reply	other threads:[~2011-06-07 10:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 21:07 [PATCH 1/2] s390/sclp_async: Use kstrtoul_from_user Peter Huewe
2011-06-06 21:07 ` Peter Huewe
2011-06-06 21:07 ` [PATCH 2/2] s390/qdio_debug: " Peter Huewe
2011-06-06 21:07   ` Peter Huewe
2011-06-07 10:27   ` Jan Glauber [this message]
2011-06-07 10:27     ` Jan Glauber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110607102748.GA10838@hal \
    --to=jang@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=frank.blaschka@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=peterhuewe@gmx.de \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.