mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: John de la Garza <john@jjdev.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	devel@driverdev.osuosl.org
Subject: Re: [PATCH] usbip:usbip_common.c: check return value of sscanf
Date: Thu, 06 Mar 2014 16:17:27 -0800	[thread overview]
Message-ID: <1394151447.16156.20.camel@joe-AO722> (raw)
In-Reply-To: <20140306235156.GA3498@vega.jjdev.com>

On Thu, 2014-03-06 at 15:51 -0800, John de la Garza wrote:
> Added code to check return value of sscanf.
[]
> diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
[]
> @@ -55,7 +55,8 @@ static ssize_t usbip_debug_store(struct device *dev,
>  				 struct device_attribute *attr, const char *buf,
>  				 size_t count)
>  {
> -	sscanf(buf, "%lx", &usbip_debug_flag);
> +	if (sscanf(buf, "%lx", &usbip_debug_flag) != 1)
> +		return -EINVAL;

Generally, it's probably better to convert these
sscanf uses to kstrto<foo>, kstrtoul in this case.



      reply	other threads:[~2014-03-07  0:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 23:51 John de la Garza
2014-03-07  0:17 ` Joe Perches [this message]

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=1394151447.16156.20.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=john@jjdev.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®