Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp898039pxb; Wed, 6 Apr 2022 03:38:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEqB6cX8+0KxEqhBl90OKNHfTYlAGXi3scnc9iI2UjYa6NaVm8z9KM4nXWwWD9ljw3xtIX X-Received: by 2002:a63:83c8:0:b0:398:7ea3:f71b with SMTP id h191-20020a6383c8000000b003987ea3f71bmr6361644pge.484.1649241480202; Wed, 06 Apr 2022 03:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649241480; cv=none; d=google.com; s=arc-20160816; b=I7lG1rvqLwGEzbI2Cbu6+WQgeFVeLMIHoeiz5Xzco1zCUL1PM8GMXOCoTAY+yMa1a6 dhacpxPrkV8Hf/UqI1abKq2N1M4zUaOzJelgQvuf24TJnqzpfOuCpFR/nwIycLXkYWCG Y1TZ0FGHiRRmyHDhFkqKTQPM9ajYo/INlC4kU/T5MnDfZIeydcQLPeUZFDwVj0MzotBo 93ebX/0WUnN0ZrJanQuNf6COCqlypcNEi3YjNa3l2nmPWb+kva3kgKwJeDUlFpfGM+gi zWayt3vChIjgw86cwgCnO6S+EQ6d0Gy2+BdN6ncuvUf4cN8UOiHcMmWZM78zmxfgduIa TWxA== 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=AKDLQe/dPEsrthvk8DnqVfdROlALev9E4MPr2/mYC3c=; b=jdN0AfRbBwimLdh2m2eNoQXj+f0ypSitgkCjUgNyQN0RpktsrfiCtUgTtDvCG/HxPG QQmY+VVUxFj08WLJ0AFvW//u2z3oBXmn0U9U9LF06oLarq9ChNmw7XpLOacrOKBvt5jr 7+/3J6pf63zqHQtwr2F1GN91PQHUtt2NZnDjmGAkXT+j1f3k89Qo6QciwpFPnj/8HsNp u+uQ4zgeVjirFsUsZCMi0d4lkX+12wLd0kzfi/vOeOBQ6ov/k5haQJUcmqO9xZjHQpeJ 0CcBKtsf1tzX44yV7fk60RMkDglClj+uC3EgceTqU07Ol9ootkyDtDDS0oWYK6CBK/3n eSbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=avwuDCDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h17-20020a635311000000b003816043ef08si15689890pgb.253.2022.04.06.03.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 03:38:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=avwuDCDJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 EF55E48BA8F; Wed, 6 Apr 2022 01:59:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837983AbiDFAtf (ORCPT + 99 others); Tue, 5 Apr 2022 20:49:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455525AbiDEQAH (ORCPT ); Tue, 5 Apr 2022 12:00:07 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A37166AD3; Tue, 5 Apr 2022 08:16:16 -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 E1B731EC0576; Tue, 5 Apr 2022 17:16:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1649171771; 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=AKDLQe/dPEsrthvk8DnqVfdROlALev9E4MPr2/mYC3c=; b=avwuDCDJzrRV5vhJCZCf6wLf1RWpmroqdHmBeTIQDKxladtn0DJ9zGp9itab8MYMyEbYss TOfTXejLUEN1L5nDRn7AZ7D7YF8ChYFuSTeKDiX2nmMJ1bkc/eI1mD4LrIpU4B8EAchEpu cnSlgQKOVSckOX99hnMsH9UATzmK88A= From: Borislav Petkov To: LKML Cc: Leon Romanovsky , Saeed Mahameed , linux-rdma@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 10/11] IB/mlx5: Fix undefined behavior due to shift overflowing the constant Date: Tue, 5 Apr 2022 17:15:16 +0200 Message-Id: <20220405151517.29753-11-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: drivers/infiniband/hw/mlx5/main.c: In function ‘translate_eth_legacy_proto_oper’: drivers/infiniband/hw/mlx5/main.c:370:2: error: case label does not reduce to an integer constant case MLX5E_PROT_MASK(MLX5E_50GBASE_KR2): ^~~~ 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: Leon Romanovsky Cc: Saeed Mahameed Cc: linux-rdma@vger.kernel.org Cc: netdev@vger.kernel.org --- include/linux/mlx5/port.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h index 28a928b0684b..e96ee1e348cb 100644 --- a/include/linux/mlx5/port.h +++ b/include/linux/mlx5/port.h @@ -141,7 +141,7 @@ enum mlx5_ptys_width { MLX5_PTYS_WIDTH_12X = 1 << 4, }; -#define MLX5E_PROT_MASK(link_mode) (1 << link_mode) +#define MLX5E_PROT_MASK(link_mode) (1U << link_mode) #define MLX5_GET_ETH_PROTO(reg, out, ext, field) \ (ext ? MLX5_GET(reg, out, ext_##field) : \ MLX5_GET(reg, out, field)) -- 2.35.1