Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp964218pxb; Wed, 6 Apr 2022 05:28:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9zL/udaa4Sl6QY5vCGg7L8dzV7ZWb2krFWmzyc7n/iaKio1kmzNNyBa5zWGaHO5oN8QRh X-Received: by 2002:a63:384e:0:b0:374:ae28:71fc with SMTP id h14-20020a63384e000000b00374ae2871fcmr6869488pgn.159.1649248126827; Wed, 06 Apr 2022 05:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649248126; cv=none; d=google.com; s=arc-20160816; b=lkQFX6kgbQWcDM/tqD/rgnvQeIBA+43W7QzB5VyTDVVGYJ2OqlGx4R2sFTXGGJKGmP qjfnG4Dwa5sd6hRfUXjdt8Mlx/f73q6XkGAVzdmw1hsZqmeAx6/gqQBwu02fmTikS7NT LQqykDj25stX8nUHZ/mqk2pL+Fznww/2JypEuK8hGdZ3drME4e0zH4U3Cr70/x3t67JH 5KEeq7cpNy3InBoWMyvKdAXA9ut7dFBwOl8lD5ZGmXestFdQe09XK+Q0UVxhZ9zhF5g4 eT4SLsCXoJRehlzpQgcixiYNeN7hZgihGQq+z2vvtmBw1i/p640ORf1O83o/OFEvoBlz wJ5A== 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=7LpwbTRZSZl3UcUUxK/gc+JLeRFgEvrqb5/MIf7cLWA=; b=FLU1V0iRNoQCqrg059PCNhX3oc7iN5a0jZC2JxYpmlcj5g1TiW0vMfIA5L/qZQzJbs 0VIcLjt7XWKsqR9kSe2T86Q82kmuUEupAlRPHHGTWZjsGgx2VlDgsEy/Pvfg5eANK+1a Eso0COuVccrrC3LaR/HvYv5+0myQYdQ6w6pYSczPAlJXoF+OdQZmm9amTSd93nec9rje nnEOC16dJWsv1r5DeQsKXBEQ5ERsRhLhpkrSyhoVzb/RETiGNLHUklZZsN5o74C7H7T8 Ng+UaiET032Z6uB8hXITaGFUTErD5wGhpBwwpMjazn6R9/wmbM7sFTetL5ksoXd0UX78 hv3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=UliPEgQU; 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 s2-20020a63dc02000000b003992df12df8si7992017pgg.465.2022.04.06.05.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:28:46 -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=UliPEgQU; 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 A4CD46F86F4; Wed, 6 Apr 2022 04:39:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1587257AbiDFAIV (ORCPT + 99 others); Tue, 5 Apr 2022 20:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1455481AbiDEQAF (ORCPT ); Tue, 5 Apr 2022 12:00:05 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E94F1400B; Tue, 5 Apr 2022 08:15:52 -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 4A8E11EC0535; Tue, 5 Apr 2022 17:15:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1649171747; 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=7LpwbTRZSZl3UcUUxK/gc+JLeRFgEvrqb5/MIf7cLWA=; b=UliPEgQUaAlMXoOHtohjpWYugorgyctYyvye+BbeTMhPLfH3wh33PXgF0F95VjaFyiY4sT dLx2BXmJC/1kxtwqOS5ZtrTBw0T22l+dKjSpkyO3hOoHkVPb1WlfcYQD3whjXnIr6DA9AH MoJu5CL9vF/fVEoGvN5VLRXgThEIeD4= From: Borislav Petkov To: LKML Cc: Seth Heasley , Neil Horman , Wolfram Sang , linux-i2c@vger.kernel.org Subject: [PATCH 05/11] i2c: ismt: Fix undefined behavior due to shift overflowing the constant Date: Tue, 5 Apr 2022 17:15:11 +0200 Message-Id: <20220405151517.29753-6-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/i2c/busses/i2c-ismt.c: In function ‘ismt_hw_init’: drivers/i2c/busses/i2c-ismt.c:770:2: error: case label does not reduce to an integer constant case ISMT_SPGT_SPD_400K: ^~~~ drivers/i2c/busses/i2c-ismt.c:773:2: error: case label does not reduce to an integer constant case ISMT_SPGT_SPD_1M: ^~~~ 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: Seth Heasley Cc: Neil Horman Cc: Wolfram Sang Cc: linux-i2c@vger.kernel.org --- drivers/i2c/busses/i2c-ismt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index f4820fd3dc13..c0364314877e 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c @@ -145,8 +145,8 @@ #define ISMT_SPGT_SPD_MASK 0xc0000000 /* SMBus Speed mask */ #define ISMT_SPGT_SPD_80K 0x00 /* 80 kHz */ #define ISMT_SPGT_SPD_100K (0x1 << 30) /* 100 kHz */ -#define ISMT_SPGT_SPD_400K (0x2 << 30) /* 400 kHz */ -#define ISMT_SPGT_SPD_1M (0x3 << 30) /* 1 MHz */ +#define ISMT_SPGT_SPD_400K (0x2U << 30) /* 400 kHz */ +#define ISMT_SPGT_SPD_1M (0x3U << 30) /* 1 MHz */ /* MSI Control Register (MSICTL) bit definitions */ -- 2.35.1