All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging/usbip: fix store_attach() sscanf return value check
@ 2014-03-24 23:12 Shuah Khan
  2014-03-25  0:38 ` Greg KH
  2014-03-25 16:38 ` Sergei Shtylyov
  0 siblings, 2 replies; 4+ messages in thread
From: Shuah Khan @ 2014-03-24 23:12 UTC (permalink / raw)
  To: gregkh, john, ced; +Cc: Shuah Khan, linux-usb, devel, linux-kernel, shuahkhan

Fix commit - 88fa1ebfa21b5deaaad2dc88ecd9f6af91796cf7
This commit added return value check for sscanf() that parses the
input buffer for four input items. However, the return value check
is incorrect, as it checks for one input item instead of four which
is what it is expecting in the input buffer. As a result, sscanf()
will always fail even when the input buffer is correct.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
 drivers/staging/usbip/vhci_sysfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c
index e098032..1ff24e9 100644
--- a/drivers/staging/usbip/vhci_sysfs.c
+++ b/drivers/staging/usbip/vhci_sysfs.c
@@ -183,7 +183,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,
 	 * @devid: unique device identifier in a remote host
 	 * @speed: usb device speed in a remote host
 	 */
-	if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 1)
+	if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 4)
 		return -EINVAL;
 
 	usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n",
-- 
1.7.10.4


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

* Re: [PATCH] staging/usbip: fix store_attach() sscanf return value check
  2014-03-24 23:12 [PATCH] staging/usbip: fix store_attach() sscanf return value check Shuah Khan
@ 2014-03-25  0:38 ` Greg KH
  2014-03-25  2:34   ` Shuah Khan
  2014-03-25 16:38 ` Sergei Shtylyov
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2014-03-25  0:38 UTC (permalink / raw)
  To: Shuah Khan; +Cc: john, ced, devel, linux-usb, linux-kernel, shuahkhan

On Mon, Mar 24, 2014 at 05:12:09PM -0600, Shuah Khan wrote:
> Fix commit - 88fa1ebfa21b5deaaad2dc88ecd9f6af91796cf7

What do you mean by this line?

> This commit added return value check for sscanf() that parses the
> input buffer for four input items. However, the return value check
> is incorrect, as it checks for one input item instead of four which
> is what it is expecting in the input buffer. As a result, sscanf()
> will always fail even when the input buffer is correct.
> 
> Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
> ---
>  drivers/staging/usbip/vhci_sysfs.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c
> index e098032..1ff24e9 100644
> --- a/drivers/staging/usbip/vhci_sysfs.c
> +++ b/drivers/staging/usbip/vhci_sysfs.c
> @@ -183,7 +183,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,
>  	 * @devid: unique device identifier in a remote host
>  	 * @speed: usb device speed in a remote host
>  	 */
> -	if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 1)
> +	if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 4)
>  		return -EINVAL;
>  
>  	usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n",
> -- 
> 1.7.10.4
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging/usbip: fix store_attach() sscanf return value check
  2014-03-25  0:38 ` Greg KH
@ 2014-03-25  2:34   ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2014-03-25  2:34 UTC (permalink / raw)
  To: Greg KH; +Cc: john, ced, devel, linux-usb, linux-kernel, shuahkhan, Shuah Khan

On 03/24/2014 06:38 PM, Greg KH wrote:
> On Mon, Mar 24, 2014 at 05:12:09PM -0600, Shuah Khan wrote:
>> Fix commit - 88fa1ebfa21b5deaaad2dc88ecd9f6af91796cf7
>
> What do you mean by this line?
>

Nothing really. Sloppiness on my part. I was keeping notes as I was 
chasing the problem and those ended up in the change log. Sorry about. 
Will fix the change log and resend the patch.

-- Shuah


-- 
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com | (970) 672-0658

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

* Re: [PATCH] staging/usbip: fix store_attach() sscanf return value check
  2014-03-24 23:12 [PATCH] staging/usbip: fix store_attach() sscanf return value check Shuah Khan
  2014-03-25  0:38 ` Greg KH
@ 2014-03-25 16:38 ` Sergei Shtylyov
  1 sibling, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2014-03-25 16:38 UTC (permalink / raw)
  To: Shuah Khan, gregkh, john, ced; +Cc: linux-usb, devel, linux-kernel, shuahkhan

Hello.

On 03/25/2014 02:12 AM, Shuah Khan wrote:

> Fix commit - 88fa1ebfa21b5deaaad2dc88ecd9f6af91796cf7

    Please also specify that commit's summary line in parens. Also, there's 
now an established format for such things:

Fixes: <12-digit SHA ID> ("<summary line>")

    You can place such line before your signoff line.

> This commit added return value check for sscanf() that parses the
> input buffer for four input items. However, the return value check
> is incorrect, as it checks for one input item instead of four which
> is what it is expecting in the input buffer. As a result, sscanf()
> will always fail even when the input buffer is correct.

> Signed-off-by: Shuah Khan <shuah.kh@samsung.com>

WBR, Sergei


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

end of thread, other threads:[~2014-03-25 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-24 23:12 [PATCH] staging/usbip: fix store_attach() sscanf return value check Shuah Khan
2014-03-25  0:38 ` Greg KH
2014-03-25  2:34   ` Shuah Khan
2014-03-25 16:38 ` Sergei Shtylyov

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.