From 91282110ddebf152301ff4ffcd992da7c0264947 Mon Sep 17 00:00:00 2001 From: Jonathan Dieter Date: Mon, 27 Feb 2017 10:16:03 +0200 Subject: [PATCH] Fix 32-bit build failures Signed-off-by: Jonathan Dieter --- 0001-usbip-Fix-format-overflow.patch | 26 ++++++++++--------- ...bip-Fix-implicit-fallthrough-warning.patch | 6 ++--- usbip.spec | 5 +++- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/0001-usbip-Fix-format-overflow.patch b/0001-usbip-Fix-format-overflow.patch index 67ce071..bbf4940 100644 --- a/0001-usbip-Fix-format-overflow.patch +++ b/0001-usbip-Fix-format-overflow.patch @@ -1,7 +1,7 @@ -From ad4d8dccc457e3b45b47fd5c5fdebfcf0171aa5e Mon Sep 17 00:00:00 2001 +From cd2517f4b56e7147d013c7030e09d2c2e3562f2a Mon Sep 17 00:00:00 2001 From: Jonathan Dieter -Date: Wed, 22 Feb 2017 20:03:06 +0200 -Subject: [PATCH] usbip: Fix-format-overflow +Date: Mon, 27 Feb 2017 10:04:29 +0200 +Subject: [PATCH v4 1/2] usbip: Fix-format-overflow The usbip userspace tools call sprintf()/snprintf() and don't check for the return value which can lead the paths to overflow, truncating the @@ -17,15 +17,16 @@ one place and adding checks for the return value of snprintf(). Reviewed-by: Peter Senna Tschudin Signed-off-by: Jonathan Dieter --- - tools/usb/usbip/libsrc/usbip_common.c | 8 +++++++- + + tools/usb/usbip/libsrc/usbip_common.c | 9 ++++++++- tools/usb/usbip/libsrc/usbip_host_common.c | 28 +++++++++++++++++++++++----- - 2 files changed, 30 insertions(+), 6 deletions(-) + 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/tools/usb/usbip/libsrc/usbip_common.c b/tools/usb/usbip/libsrc/usbip_common.c -index ac73710..66017d7 100644 +index ac73710..1517a23 100644 --- a/tools/usb/usbip/libsrc/usbip_common.c +++ b/tools/usb/usbip/libsrc/usbip_common.c -@@ -215,9 +215,15 @@ int read_usb_interface(struct usbip_usb_device *udev, int i, +@@ -215,9 +215,16 @@ int read_usb_interface(struct usbip_usb_device *udev, int i, struct usbip_usb_interface *uinf) { char busid[SYSFS_BUS_ID_SIZE]; @@ -36,14 +37,15 @@ index ac73710..66017d7 100644 + size = snprintf(busid, sizeof(busid), "%s:%d.%d", + udev->busid, udev->bConfigurationValue, i); + if (size < 0 || (unsigned int)size >= sizeof(busid)) { -+ err("busid length %i >= %lu or < 0", size, sizeof(busid)); ++ err("busid length %i >= %lu or < 0", size, ++ (long unsigned)sizeof(busid)); + return -1; + } sif = udev_device_new_from_subsystem_sysname(udev_context, "usb", busid); if (!sif) { diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c b/tools/usb/usbip/libsrc/usbip_host_common.c -index 9d41522..6fb91d9 100644 +index 9d41522..6ff7b60 100644 --- a/tools/usb/usbip/libsrc/usbip_host_common.c +++ b/tools/usb/usbip/libsrc/usbip_host_common.c @@ -40,13 +40,20 @@ struct udev *udev_context; @@ -62,7 +64,7 @@ index 9d41522..6fb91d9 100644 + "%s/usbip_status", udev->path); + if (size < 0 || (unsigned int)size >= sizeof(status_attr_path)) { + err("usbip_status path length %i >= %lu or < 0", size, -+ sizeof(status_attr_path)); ++ (long unsigned)sizeof(status_attr_path)); + return -1; + } + @@ -87,7 +89,7 @@ index 9d41522..6fb91d9 100644 + edev->udev.path, attr_name); + if (size < 0 || (unsigned int)size >= sizeof(sockfd_attr_path)) { + err("exported device path length %i >= %lu or < 0", size, -+ sizeof(sockfd_attr_path)); ++ (long unsigned)sizeof(sockfd_attr_path)); + return -1; + } @@ -95,7 +97,7 @@ index 9d41522..6fb91d9 100644 + size = snprintf(sockfd_buff, sizeof(sockfd_buff), "%d\n", sockfd); + if (size < 0 || (unsigned int)size >= sizeof(sockfd_buff)) { + err("socket length %i >= %lu or < 0", size, -+ sizeof(sockfd_buff)); ++ (long unsigned)sizeof(sockfd_buff)); + return -1; + } diff --git a/0002-usbip-Fix-implicit-fallthrough-warning.patch b/0002-usbip-Fix-implicit-fallthrough-warning.patch index 5adceba..3e3b477 100644 --- a/0002-usbip-Fix-implicit-fallthrough-warning.patch +++ b/0002-usbip-Fix-implicit-fallthrough-warning.patch @@ -1,7 +1,7 @@ -From 1d33ad30f2bad7d2c3f431b676e57f092596840c Mon Sep 17 00:00:00 2001 +From b1cabcfde670c82aff0ef07c21095d63c29cbf3e Mon Sep 17 00:00:00 2001 From: Jonathan Dieter -Date: Tue, 21 Feb 2017 19:41:35 +0200 -Subject: [PATCH v2 2/2] usbip: Fix implicit fallthrough warning +Date: Mon, 27 Feb 2017 10:13:01 +0200 +Subject: [PATCH v4 2/2] usbip: Fix implicit fallthrough warning GCC 7 now warns when switch statements fall through implicitly, and with -Werror enabled in configure.ac, that makes these tools unbuildable. diff --git a/usbip.spec b/usbip.spec index f71dc26..e01a415 100644 --- a/usbip.spec +++ b/usbip.spec @@ -5,7 +5,7 @@ License: GPLv2+ Summary: USB/IP user-space Group: System Environment/Daemons Version: 4.9.9 -Release: 2%{?dist} +Release: 3%{?dist} #Source: https://www.kernel.org/pub/linux/kernel/v3.x/linux-%%{version}.tar.xz # In the interests of keeping the source rpm from being ridiculously large, # download the Linux kernel from above and run `extract_usbip.sh ` @@ -94,6 +94,9 @@ install -pm 644 %{SOURCE2} %{buildroot}%{_unitdir} %{_libdir}/*.so %changelog +* Mon Feb 27 2017 Jonathan Dieter - 4.9.9-3 +- Fix 32-bit build failures + * Mon Feb 20 2017 Jonathan Dieter - 4.9.9-2 - Add patches to fix continuing build failures with GCC 7