Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp772937pxb; Tue, 5 Apr 2022 22:42:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4lNdLTlJlBkQs+4ckZUvg/WSOGOyomvgooMNpx9UAjjfpILpqd+PMs1+uPLAyATsiyFNj X-Received: by 2002:a17:902:6901:b0:156:4aad:fad7 with SMTP id j1-20020a170902690100b001564aadfad7mr7130523plk.33.1649223777133; Tue, 05 Apr 2022 22:42:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649223777; cv=none; d=google.com; s=arc-20160816; b=khtAS4eWw0SC54DXoIpfkEE0vlK4ah3RcDLRXQ6/ktU+HSVWtxeAm6RuXl4r2/JrMw ddtjFbySi5H8NASd72UnUBUrmNyiF9FaYcH2jRFXfM/iPtTuDqoqMVUSYmcno0mTuiua gG+YqwAYzBT1jYRkB9md4aazxUCaJdfs1ScXJfDV1CigkGalAEbN8I1NiTum8eQITOho ps7wlRYJz7QML2zUjza1Fr/6i+rt7VndTwdbF8piC2kUrYdgOXScyIZ1sHTGl397AjEj EIUD7XJ6OV/EnB0GeyEVVXRYMtTIfWG99ulP36qlTLkYlHLk2WGtI5lsOFrZ6wzW1nB3 oduA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SmhdfcsfbUleu5su8WIpv3awYN3mvxwGNPN2GgtP+eM=; b=KbeV4nWcjBAB9PcQaIkBgzgIZpkx/lsWKcUfdVroZG2ZqOpeB30vwoAHUz1cTLyRTu WZPvp5tONt7fs3OmPjDFWl9XUMA4XgjeaI2ZzXPZckBziuOvFlbEykgnRNS/QbIBJO+I 2GdMk+mbL4BuwMQXqex8sQiolDlU58j37/wpVtDCoFqoFKnRuh98VJ2JULrw+XVUZKgD 7tASGK6jjOw6e2a+quar+otm7+7vsxefKFfQO6fWE1dBdE0BaTdeYyMPk7147Cp6hcGO GICISEnnJufP6Nm+Lrm/R0YztzqVF8+RTk+AcGXJ70L66Cga/26dU7gcOjwj/Pb2wUxZ jyDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=lirn6QWU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d1-20020a170902728100b00156ef408753si175261pll.238.2022.04.05.22.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:42:57 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=lirn6QWU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ACF13445878; Tue, 5 Apr 2022 21:48:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383636AbiDEUlt (ORCPT + 99 others); Tue, 5 Apr 2022 16:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455456AbiDEQAD (ORCPT ); Tue, 5 Apr 2022 12:00:03 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AE0055BF9 for ; Tue, 5 Apr 2022 08:15:38 -0700 (PDT) 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 Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)) -- 2.35.1