Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1057898pxk; Mon, 31 Aug 2020 08:40:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvPqZXojq+4qjP4XyaSvCXv3L87oNJZOHILVNvlDMpVOQnQNTEyssBfBIqdxwoyVz4xNBh X-Received: by 2002:a17:906:454a:: with SMTP id s10mr1645006ejq.138.1598888456448; Mon, 31 Aug 2020 08:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598888456; cv=none; d=google.com; s=arc-20160816; b=NFU87uMgFNZZOpb6JrMYIsMeGZShRUYTRQJEF6hfDL9tI8Na7I9Sguqq0g0qRct0Jc h2uJcZAn8+KbJeRAVEkcB14tYk8EkycrYBANXWxK4u55q/9BO1eBW+Dl0NJDXOXy3DY6 cpAvLlY6rNGwQECUs2SOOP7Af4yF8CLwQbUy1atOU4EeezxikMJP4vWib3Yds7NcSZIv tq+dHyTnjWewA6o6fcchbX8osCrOIpZQ5JZ1xY9+M+FGyJ0IENDyC4CIBXMuuGISoLV+ PUlD76qbyM5GUq4kLDebIzRsRJfEcDA8eMi1WhZs6NqwXAJZNfcERYkdMLxypFHdZ9pb 2WNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4HPa8XWIXVc0UC28mF9vfEk3jbPySdxlAHC5WdmvDng=; b=V3fnWYsQHuqporBzWiWmmn/YadWUS8xfDqyperkNBt/wMuLXr6P/5XukQN46foflVU sGy7HTFjBvAHWT53YF+mTqYlhGW8Mq0X4GtPNoOtX2mGQik+5KTnPd6rEFkhgUU1EVI3 u/7tweXmn5a2INkQChPH993ek+PaPate65JL4IWPgsiuJnv6zKhIzSw2E4eEyVHxIT13 9F3iYGqoIGhhhYw/GMZXHVEpPOXR2EfsrqxaAZrmrMi4X6gtIiCR4ml9H/pnIdDdBOh9 PtzDwnTCHUTvtVBwFlLd/P3kjEdBoej9S+B91JjUX2pwB6P8M4DKnKXalCt0pH6XUAmm KWHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fwVqPwEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz7si3542259ejb.441.2020.08.31.08.40.33; Mon, 31 Aug 2020 08:40:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fwVqPwEi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729230AbgHaPiz (ORCPT + 99 others); Mon, 31 Aug 2020 11:38:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:39074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728555AbgHaPaP (ORCPT ); Mon, 31 Aug 2020 11:30:15 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A1614207EA; Mon, 31 Aug 2020 15:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887815; bh=d5CrpnaLe/hzDWsm51N0bFeSs/nJtCjmHu60f90JOmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fwVqPwEijAmw69jDbAngpKi0LonGj0bGRlL63ri1+6y6qxzRnF1iXfJmDp/ZElVJ5 i9P3pF8HEVvCfjclsW24L+FEEARvgK5k02HDakrZ54gXU/E+I2C6vcqjnQxpdOteCp mrtpc9HPpacEuq7hKK0/BDtJxiO8nABFk0yFoj1k= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ray Jui , Wolfram Sang , Florian Fainelli , Sasha Levin , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.8 27/42] i2c: iproc: Fix shifting 31 bits Date: Mon, 31 Aug 2020 11:29:19 -0400 Message-Id: <20200831152934.1023912-27-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831152934.1023912-1-sashal@kernel.org> References: <20200831152934.1023912-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ray Jui [ Upstream commit 0204081128d582965e9e39ca83ee6e4f7d27142b ] Fix undefined behaviour in the iProc I2C driver by using 'BIT' marcro. Reported-by: Wolfram Sang Signed-off-by: Ray Jui Acked-by: Florian Fainelli [wsa: in commit msg, don't say 'checkpatch' but name the issue] Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-bcm-iproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c index 688e928188214..d8295b1c379d1 100644 --- a/drivers/i2c/busses/i2c-bcm-iproc.c +++ b/drivers/i2c/busses/i2c-bcm-iproc.c @@ -720,7 +720,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c, /* mark the last byte */ if (!process_call && (i == msg->len - 1)) - val |= 1 << M_TX_WR_STATUS_SHIFT; + val |= BIT(M_TX_WR_STATUS_SHIFT); iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val); } @@ -738,7 +738,7 @@ static int bcm_iproc_i2c_xfer_internal(struct bcm_iproc_i2c_dev *iproc_i2c, */ addr = i2c_8bit_addr_from_msg(msg); /* mark it the last byte out */ - val = addr | (1 << M_TX_WR_STATUS_SHIFT); + val = addr | BIT(M_TX_WR_STATUS_SHIFT); iproc_i2c_wr_reg(iproc_i2c, M_TX_OFFSET, val); } -- 2.25.1