[PATCH] usbip: fix vhci attach sockfd sscanf format

Xu Rao posted 1 patch 1 week ago
drivers/usb/usbip/vhci_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] usbip: fix vhci attach sockfd sscanf format
Posted by Xu Rao 1 week ago
The vhci attach sysfs store callback parses the socket
descriptor into an int, but the sscanf() format uses %u.
Use %d so the conversion specifier matches the destination
type.

Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
 drivers/usb/usbip/vhci_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
index 5bc8c47788d4..3cc4008397cb 100644
--- a/drivers/usb/usbip/vhci_sysfs.c
+++ b/drivers/usb/usbip/vhci_sysfs.c
@@ -327,7 +327,7 @@ static ssize_t attach_store(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", &port, &sockfd, &devid, &speed) != 4)
+	if (sscanf(buf, "%u %d %u %u", &port, &sockfd, &devid, &speed) != 4)
 		return -EINVAL;
 	pdev_nr = port_to_pdev_nr(port);
 	rhport = port_to_rhport(port);
--
2.50.1