Patch "ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant" has been added to the 5.17-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant

to the 5.17-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     alsa-usb-audio-fix-undefined-behavior-due-to-shift-o.patch
and it can be found in the queue-5.17 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d727b356a0940e663c9abf9aea1e5cb0fe2d2fc5
Author: Borislav Petkov <bp@xxxxxxx>
Date:   Tue Apr 5 17:15:08 2022 +0200

    ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
    
    [ Upstream commit 1ef8715975de8bd481abbd0839ed4f49d9e5b0ff ]
    
    Fix:
    
      sound/usb/midi.c: In function ‘snd_usbmidi_out_endpoint_create’:
      sound/usb/midi.c:1389:2: error: case label does not reduce to an integer constant
        case USB_ID(0xfc08, 0x0101): /* Unknown vendor Cable */
        ^~~~
    
    See https://lore.kernel.org/r/YkwQ6%2BtIH8GQpuct@xxxxxxx for the gory
    details as to why it triggers with older gccs only.
    
    [ A slight correction with parentheses around the argument by tiwai ]
    
    Signed-off-by: Borislav Petkov <bp@xxxxxxx>
    Link: https://lore.kernel.org/r/20220405151517.29753-3-bp@xxxxxxxxx
    Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 167834133b9b..b8359a0aa008 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -8,7 +8,7 @@
  */
 
 /* handling of USB vendor/product ID pairs as 32-bit numbers */
-#define USB_ID(vendor, product) (((vendor) << 16) | (product))
+#define USB_ID(vendor, product) (((unsigned int)(vendor) << 16) | (product))
 #define USB_ID_VENDOR(id) ((id) >> 16)
 #define USB_ID_PRODUCT(id) ((u16)(id))
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux