package/libusb: fix maybe-uninitialized error
PATCH 1/1 package/libusb: fix maybe-uninitialized error
From: Yegor Yefremov <[email protected]>
Initialize active_config to an invalid value to avoid the following compilation error:
os/linux_usbfs.c: In function ‘op_get_configuration’:os/linux_usbfs.c:1452:12: error: ‘active_config’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1452 | *config = (uint8_t)active_config;
Upstream URL: https://github.com/libusb/libusb/pull/1062
--- ..._usbfs-fix-maybe-uninitialized-error.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 package/libusb/0002-linux_usbfs-fix-maybe-uninitialized-error.patch
package/libusb/0002-linux_usbfs-fix-maybe-uninitialized-error.patch new file +36 -0
@@ -0,0 +1,36 @@ +From bea5891591402f14940a607eafbdcd169ff8827f Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +Date: Sun, 6 Feb 2022 07:12:14 +0100 +Subject: [PATCH 2/2] linux_usbfs: fix maybe-uninitialized error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Initialize active_config to an invalid value to avoid the following +compilation error: + +os/linux_usbfs.c: In function ‘op_get_configuration’: +os/linux_usbfs.c:1452:12: error: ‘active_config’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + 1452 | *config = (uint8_t)active_config; + +Signed-off-by: Yegor Yefremov <[email protected]> +--- + libusb/os/linux_usbfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c +index c300675..285d9ca 100644 +--- a/libusb/os/linux_usbfs.c ++++ b/libusb/os/linux_usbfs.c +@@ -1429,7 +1429,7 @@ static int op_get_configuration(struct libusb_device_handle *handle, + uint8_t *config) + { + struct linux_device_priv *priv = usbi_get_device_priv(handle->dev); +- int active_config; ++ int active_config = -1; /* to please compiler */ + int r; + + if (priv->sysfs_dir) { +-- +2.17.0 +
Signature · 6 lines
2.17.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 5 lines · yegorslists--- via buildroot
From: Yegor Yefremov <[email protected]>
Initialize
active_configto an invalid value to avoid the following compilation error:
Quoted 8 lines
os/linux_usbfs.c: In function ‘op_get_configuration’:os/linux_usbfs.c:1452:12: error: ‘active_config’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1452 | *config = (uint8_t)active_config;Upstream URL: https://github.com/libusb/libusb/pull/1062
Signed-off-by Yegor Yefremov <[email protected]>---
This problem also affects my build, but with the patch, it works fine:
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedYegor, All,
On 2022-02-16 14:31 +0100, yegorslists--- via buildroot spake thusly:
Quoted 10 lines
From: Yegor Yefremov <[email protected]>
Initialize
active_configto an invalid value to avoid the following compilation error:
os/linux_usbfs.c: In function ‘op_get_configuration’:os/linux_usbfs.c:1452:12: error: ‘active_config’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1452 | *config = (uint8_t)active_config;Upstream URL: https://github.com/libusb/libusb/pull/1062
I've moved that into the patch itself, as it is either to find when we update the version and have to check if the patch has to be removed or rebased.
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 55 lines
Signed-off-by Yegor Yefremov <[email protected]>--- ..._usbfs-fix-maybe-uninitialized-error.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 package/libusb/0002-linux_usbfs-fix-maybe-uninitialized-error.patchpackage/libusb/0002-linux_usbfs-fix-maybe-uninitialized-error.patch new file +36
-0@@ -0,0 +1,36 @@ +From bea5891591402f14940a607eafbdcd169ff8827f Mon Sep 17 00:00:00 2001 +From: Yegor Yefremov <[email protected]> +Date: Sun, 6 Feb 2022 07:12:14 +0100 +Subject: [PATCH 2/2] linux_usbfs: fix maybe-uninitialized error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Initialize active_config to an invalid value to avoid the following +compilation error: + +os/linux_usbfs.c: In function ‘op_get_configuration’: +os/linux_usbfs.c:1452:12: error: ‘active_config’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + 1452 | *config = (uint8_t)active_config; + +Signed-off-by: Yegor Yefremov <[email protected]> +--- + libusb/os/linux_usbfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c +index c300675..285d9ca 100644 +--- a/libusb/os/linux_usbfs.c ++++ b/libusb/os/linux_usbfs.c +@@ -1429,7 +1429,7 @@ static int op_get_configuration(struct libusb_device_handle *handle, + uint8_t *config) + { + struct linux_device_priv *priv = usbi_get_device_priv(handle->dev); +- int active_config; ++ int active_config = -1; /* to please compiler */ + int r; + + if (priv->sysfs_dir) { +-- +2.17.0 +Signature · 6 lines
2.17.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot