From patchwork Tue Apr 5 15:15:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 12801730 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58290C433F5 for ; Tue, 5 Apr 2022 15:16:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A6B5F17F0; Tue, 5 Apr 2022 17:15:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A6B5F17F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1649171797; bh=3kC6FbzoLO5Mb01GfHH3kWOniJAss/aDLjtdr1Nqs7s=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=nxc8Xvcm8savYHfnbBVvuPqC7NEc0kyP2rWZx0EWiI4ZFrIHazL2U6rQdcwHArdmt 9CqPExQ+fW0YIvd0wOT7XTwiWkLEeYkSMNejXfDRK//BsPOSMdL9vZgnB38vuogKmi Cv40xWx5KpprtyQ3iT1t2k1HNEaU1cn5O5H1AMg4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 26F57F8014B; Tue, 5 Apr 2022 17:15:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 84E7DF8016A; Tue, 5 Apr 2022 17:15:45 +0200 (CEST) Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A251AF8012C for ; Tue, 5 Apr 2022 17:15:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A251AF8012C Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=alien8.de header.i=@alien8.de header.b="lirn6QWU" Received: from zn.tnic (p2e55dff8.dip0.t-ipconnect.de [46.85.223.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 4181C1EC04AD; Tue, 5 Apr 2022 17:15:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1649171733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SmhdfcsfbUleu5su8WIpv3awYN3mvxwGNPN2GgtP+eM=; b=lirn6QWU6l3x2HY1jEv7bpHHvQQOsPyAB0GuR/9TahNHORoVCpFoMP1z4hTe+UecGKfLr0 k0Skp9sPK3HhHITVFI942ZBb6HdEdhT+J0CWGY+G16AOyJxf+Rbam+HLgZD+pR06H6w0nw dOLqldmTnMghaA/Etg8CW5iR4TIjgac= From: Borislav Petkov To: LKML Subject: [PATCH 02/11] ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant Date: Tue, 5 Apr 2022 17:15:08 +0200 Message-Id: <20220405151517.29753-3-bp@alien8.de> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405151517.29753-1-bp@alien8.de> References: <20220405151517.29753-1-bp@alien8.de> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Takashi Iwai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Borislav Petkov 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@zn.tnic for the gory details as to why it triggers with older gccs only. Signed-off-by: Borislav Petkov Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: alsa-devel@alsa-project.org --- sound/usb/usbaudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 167834133b9b..2b3dd55e8ee0 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))