From: John de la Garza Date: Thu, 6 Mar 2014 23:51:59 +0000 (-0800) Subject: usbip:usbip_common.c: check return value of sscanf X-Git-Tag: v3.15-rc1~139^2~614 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=bf988c16a3d65c853bd3eb0ec4f15a88a76a3ccd;p=~emulex%2Finfiniband.git usbip:usbip_common.c: check return value of sscanf Added code to check return value of sscanf. Signed-off-by: John de la Garza Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 4a2aab16b10..2a11233d44f 100644 --- 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; return count; } DEVICE_ATTR_RW(usbip_debug);