From: Benoit Goby Date: Tue, 29 May 2012 20:57:27 +0000 (-0700) Subject: usb: gadget: android: Fix product name X-Git-Tag: firefly_0821_release~4090^2~730 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c8479b8fffbab3130d96dcb2363691bf0c8cc5c1;p=firefly-linux-kernel-4.4.55.git usb: gadget: android: Fix product name Product names may contain spaces and scanf %s only matches the 1st word. Use strlcpy instead. Change-Id: Ie8703fea9775f7fc17fe615a42597ca3816d36b0 Signed-off-by: Benoit Goby --- diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index d2c3393237b6..7a2af5844113 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -1053,10 +1053,7 @@ field ## _store(struct device *dev, struct device_attribute *attr, \ { \ if (size >= sizeof(buffer)) \ return -EINVAL; \ - if (sscanf(buf, "%s", buffer) == 1) { \ - return size; \ - } \ - return -1; \ + return strlcpy(buffer, buf, sizeof(buffer)); \ } \ static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, field ## _show, field ## _store);