[spice-gtk,1/2] usb-device-manager: Fix number truncation by spice_usb_device_get_busnum

Submitted by Frediano Ziglio on Aug. 1, 2019, 9:52 a.m.

Details

Message ID 20190801095222.17475-1-fziglio@redhat.com
State Accepted
Commit 930d9204ea83b5aabd0d98ba88dc5343878e0e5a
Headers show
Series "Series without cover letter" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Aug. 1, 2019, 9:52 a.m.
"bus" field is 16 bit so returning using a guint8 type potentially
truncate the value.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 src/usb-device-manager-priv.h | 2 +-
 src/usb-device-manager.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/usb-device-manager-priv.h b/src/usb-device-manager-priv.h
index 66acf6d5..2530d294 100644
--- a/src/usb-device-manager-priv.h
+++ b/src/usb-device-manager-priv.h
@@ -29,7 +29,7 @@  G_BEGIN_DECLS
 void spice_usb_device_manager_device_error(
     SpiceUsbDeviceManager *manager, SpiceUsbDevice *device, GError *err);
 
-guint8 spice_usb_device_get_busnum(const SpiceUsbDevice *device);
+guint16 spice_usb_device_get_busnum(const SpiceUsbDevice *device);
 guint8 spice_usb_device_get_devaddr(const SpiceUsbDevice *device);
 guint16 spice_usb_device_get_vid(const SpiceUsbDevice *device);
 guint16 spice_usb_device_get_pid(const SpiceUsbDevice *device);
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 544e5687..a035683d 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1490,7 +1490,7 @@  static SpiceUsbDevice *spice_usb_device_new(SpiceUsbBackendDevice *bdev)
     return info;
 }
 
-guint8 spice_usb_device_get_busnum(const SpiceUsbDevice *info)
+guint16 spice_usb_device_get_busnum(const SpiceUsbDevice *info)
 {
     const UsbDeviceInformation *b_info;
 

Comments