Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp901880rdb; Tue, 30 Jan 2024 01:55:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcO/6C+wMNfTqd1/4vnO/6+ohEJTKSWyXkvHfe9gW8IvZ/ihOczVOWmWDUVJlXLhZj0B/2 X-Received: by 2002:a05:6a00:855:b0:6dd:9eb3:1197 with SMTP id q21-20020a056a00085500b006dd9eb31197mr1153456pfk.6.1706608524095; Tue, 30 Jan 2024 01:55:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706608524; cv=pass; d=google.com; s=arc-20160816; b=ZyptDkgwxL65DylcjT8dVRjz7mxmmfSA8eoIFMmPz9v7nN3349FmXpgkQExudxA+et +Z9pbzfKdXUtfHAlirIBU0LP5Cydl7EKN5GTku5onkDzWzxwCFkh/Nv/A5nwMwLuQWOE ihb2wI895tblDmd/oVSVHR/CkX9fV0fpLgK25h6i8ia60bcCmibh5VGN9P8Saw/MHbvk Pu26poQoAKryin9eGhHAV/aWrXohSCZIMo79JrZRwkRzfRKS1Y/lL6B+tHRmVFBvYfxH YCpIAkIRrkeeSE4rh02eNmrk4Jh3q7NnJgVHX1UemJO8hlBrzr+By6wTu356dtKwjjpJ df5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=AzSdhb1EFgr8m9GCPzSJauJkFDRxOixnrXfrfcPby5k=; fh=tYg/X4lZO0PaG4MdwPGRiPH4c6ZkZ9UVVs5ZWB+/f2Y=; b=aLyXZWlF3Di6zGn+di3GnHXLXFXdjjdkbP4RMVx60HpoSfL4Mm+wiZGthOI+RGAQm+ YNId8+vyiLkb9Cr7ytHHNRazssYVlXQLsqueYHs5m71zKTJaoWFbhBHPYF7l9D1ovk5Z 7c+lA2c2uJCvPFKau6UTJT8LD/bA5VcdaolT2USp8iJbIjKqX5d6wKN0OhpjffuNf3WU +8RSiOwD8MP4wlCemH4zqlxnrDq6SD04uRJvsNTWEd098ItIWJT2w8njdOYIae2ZkSWv YUky3CRb9+2Rc13Y1q/7eYUSMw/6m8fgdM+fpgo+aQs6/ZX31c28/2kLAPHqG8GaiPIu FD4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=PM033RNt; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-44284-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44284-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w3-20020a636203000000b005cd6507bb84si7105497pgb.183.2024.01.30.01.55.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 01:55:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44284-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@sang-engineering.com header.s=k1 header.b=PM033RNt; arc=pass (i=1 spf=pass spfdomain=sang-engineering.com dkim=pass dkdomain=sang-engineering.com); spf=pass (google.com: domain of linux-kernel+bounces-44284-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44284-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7E3F5293F70 for ; Tue, 30 Jan 2024 09:42:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38B2860BAB; Tue, 30 Jan 2024 09:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="PM033RNt" Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBE6960BA8 for ; Tue, 30 Jan 2024 09:41:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706607669; cv=none; b=JleGPkp1nWwZj0KGiYlxNy81yM3AhCIpH1zw6s20O24EjkYlbqeDYjFACPMfOTSsUR4OHioQyrwOdWSjx4arb+1o1VXOK0DmdgkAZIw62rhthwlCvrPAE5gnN5yL0mTayfQ4p6/ZxIBnp9z+SIpP/bGmoVJs38r9naote6eVZHo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706607669; c=relaxed/simple; bh=2OHLsZS4PsJMPwjOKM6F0kv6fbGghDQNdDA7mW+z63U=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=VYHLCa0P0hEYJDaubAfdlojutJG3/pH7FQ65KyXDUI8GdR66tbFfkUEHepUE1Dla4r4L8IJiTC5oH7ftM5juZMyi/UaLR9RH3bEK+HIFERZYs+G7uwaOJG63Q2x/rVwSn9YRnsU3A6HgyVDpyI93ZNsBvMF8/PIBIjE66QuFTB0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=PM033RNt; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=k1; bh=AzSdhb1EFgr8m9 GCPzSJauJkFDRxOixnrXfrfcPby5k=; b=PM033RNtlmu+MGufEY5zm5sFAYMUyh jGBh4rzolkWqBQre7/9t4OI+XsEPVYVlGZBfnT8+O1jtgJm36T0MnQRKDVxpoQf+ lr9ufsjd1RSLGQx9x4OaRGVZBnxDI1iJWvXr+LeKEcIPH5/u48jPDKYcyzPvhfg6 JzSCHoV7eJVbfuJRKEPPtOESzWyeBpQf/upvVLNUjfS4hMFjVOqaPmhMZLqlap4h GeIOZMfODM2UjMpwdnj386or9JvL5vSmYBOUqk36mH2pMIFD82MmIrd+3XBrFvUy 12l1Du0TU7fVPUgUKwdkuZq6zFXj0TmSOCVC3LaIhi5a6wGqlzzJvqlg== Received: (qmail 2783205 invoked from network); 30 Jan 2024 10:41:00 +0100 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 30 Jan 2024 10:41:00 +0100 X-UD-Smtp-Session: l3s3148p1@lKVcjyYQVJlehhtJ From: Wolfram Sang To: linux-renesas-soc@vger.kernel.org Cc: Wolfram Sang , Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] spi: sh-msiof: avoid integer overflow in constants Date: Tue, 30 Jan 2024 10:40:53 +0100 Message-Id: <20240130094053.10672-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit cppcheck rightfully warned: drivers/spi/spi-sh-msiof.c:792:28: warning: Signed integer overflow for expression '7<<29'. [integerOverflow] sh_msiof_write(p, SIFCTR, SIFCTR_TFWM_1 | SIFCTR_RFWM_1); Signed-off-by: Wolfram Sang --- drivers/spi/spi-sh-msiof.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index cfc3b1ddbd22..6f12e4fb2e2e 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -136,14 +136,14 @@ struct sh_msiof_spi_priv { /* SIFCTR */ #define SIFCTR_TFWM_MASK GENMASK(31, 29) /* Transmit FIFO Watermark */ -#define SIFCTR_TFWM_64 (0 << 29) /* Transfer Request when 64 empty stages */ -#define SIFCTR_TFWM_32 (1 << 29) /* Transfer Request when 32 empty stages */ -#define SIFCTR_TFWM_24 (2 << 29) /* Transfer Request when 24 empty stages */ -#define SIFCTR_TFWM_16 (3 << 29) /* Transfer Request when 16 empty stages */ -#define SIFCTR_TFWM_12 (4 << 29) /* Transfer Request when 12 empty stages */ -#define SIFCTR_TFWM_8 (5 << 29) /* Transfer Request when 8 empty stages */ -#define SIFCTR_TFWM_4 (6 << 29) /* Transfer Request when 4 empty stages */ -#define SIFCTR_TFWM_1 (7 << 29) /* Transfer Request when 1 empty stage */ +#define SIFCTR_TFWM_64 (0UL << 29) /* Transfer Request when 64 empty stages */ +#define SIFCTR_TFWM_32 (1UL << 29) /* Transfer Request when 32 empty stages */ +#define SIFCTR_TFWM_24 (2UL << 29) /* Transfer Request when 24 empty stages */ +#define SIFCTR_TFWM_16 (3UL << 29) /* Transfer Request when 16 empty stages */ +#define SIFCTR_TFWM_12 (4UL << 29) /* Transfer Request when 12 empty stages */ +#define SIFCTR_TFWM_8 (5UL << 29) /* Transfer Request when 8 empty stages */ +#define SIFCTR_TFWM_4 (6UL << 29) /* Transfer Request when 4 empty stages */ +#define SIFCTR_TFWM_1 (7UL << 29) /* Transfer Request when 1 empty stage */ #define SIFCTR_TFUA_MASK GENMASK(26, 20) /* Transmit FIFO Usable Area */ #define SIFCTR_TFUA_SHIFT 20 #define SIFCTR_TFUA(i) ((i) << SIFCTR_TFUA_SHIFT) -- 2.39.2