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

Victor Toso victortoso at redhat.com
Fri Aug 2 10:49:20 UTC 2019


For both patches,
Acked-by: Victor Toso <victortoso at redhat.com>

On Thu, Aug 01, 2019 at 10:52:21AM +0100, Frediano Ziglio wrote:
> "bus" field is 16 bit so returning using a guint8 type potentially
> truncate the value.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  src/usb-device-manager-priv.h | 2 +-
>  src/usb-device-manager.c      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> 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;
>  
> -- 
> 2.20.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190802/7cfb7fa1/attachment.sig>


More information about the Spice-devel mailing list