From patchwork Thu Jun 30 06:39:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xenia Ragiadakou X-Patchwork-Id: 12901265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3EBBC43334 for ; Thu, 30 Jun 2022 06:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=e2g4CVs7ga/I0kzhgQrDjJovLFOuqFuO+TOVQQxtFM8=; b=KT598OdqCTruxl n7VTbkKqSVIhSQshTOkv8dksSy0GK0U7s3jN7dsPfCUeXA+mV27EfhnIykx2CzuGAYY979mB2N95O k83PkXIuqeJkXildeEkTOy08WxAh80m9tPYPoiFHqyoA+XifSuRnlkvdVKixGs0XVNQNCpi0tKTXy /hONn03QNjJqb0P2pIDi0zezHV9kq7Sa4UzjjgETMFyDGTYT8XxUO0vDhblOqFqGBWhckrwBQivqS UKbP3Z+c9e1cr/ofpIhZ06CXmdYrzqnsJTjTc6+nqYYXfI42cjqlHznWc4Jds76aytoGbmpamftgf Tmzp0uQmDWFA6JEerCKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6nqg-00FXhT-4j; Thu, 30 Jun 2022 06:40:22 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6nqd-00FXfR-4Q for linux-arm-kernel@lists.infradead.org; Thu, 30 Jun 2022 06:40:20 +0000 Received: by mail-ed1-x533.google.com with SMTP id e40so25232077eda.2 for ; Wed, 29 Jun 2022 23:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5YRjk+I1tOU+IE/aXdonB59E6sy7aNXVn8XEDauefqQ=; b=CrZpADPV9qdNUMyNR0WCBSyyHAhUtDgoCe0NWzMNFi7M0+7nQsggCNreJqHql8H0fW KlM22JXiYUrKpr5EJ6rPKnNYXjnARkmT5KB4NB/pCauB+Th4HD0raxHvl2s5mWV+3lCm zKjto8Ywx97VLoTHMQqZGZbOjpJ792BwqAqHE9tXD5QOOFY2LVyk6NqsGsJWAz7hziTA 4Vb1pWTLsq7a1L0ezJz/P61elhmqGzWJ0UixxQAVgqv8biN+mLnS4NwvBP7Ly73s1ZyK PVskO49lOWESGRRH/ESlnaQ3KWrWC331sruD+A1XHMOePno/2SStnsvFH6rkf+tvQFSy LFaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5YRjk+I1tOU+IE/aXdonB59E6sy7aNXVn8XEDauefqQ=; b=hX8uI7v8u/EOOv3MECgKlBS7/cbvhGCUFQqkxQhY6HV6k452ccycdotgiaG0Dq/jxw tERSJRxlslKcvhpTthZv9bhrl/734bRSmTz0GaqBnk2ahYAV/epPXiuXopevlnKZA0YW 92o5/kdYmjPdgAVSwmozT/KPIfpLQnhqGHOvjrGznvZakuDIPlLTgvW28hYUWtxCceQg 9Ov7L/xHr2uATBJgHpl3lOJP5+uG2xW8LFxRJHkLiHOU+i0n3sj1LSwb+qyhLWXanPbP RNhEZY7Sx+j3qlAoCspIA6W/wE1oLwUYoUywnGxH5w0lsXcdFZOMAF4zuEtyGSeK3qx8 04vg== X-Gm-Message-State: AJIora/fWh0URX7iQlNgGDGFalT2E7YWeGnQGeOx35yN9lttdinuP51p UeXXUGvppPAc1GOJHgMuneI= X-Google-Smtp-Source: AGRyM1vRJhE//LmjjGmIeJh5OLMJsvM8XsEeSlrk8TO1LDZBLk7KUtQzYrQE/U3WiDU0tnr5r4BYPA== X-Received: by 2002:a05:6402:50ce:b0:435:a2bf:e44d with SMTP id h14-20020a05640250ce00b00435a2bfe44dmr9465489edb.386.1656571213480; Wed, 29 Jun 2022 23:40:13 -0700 (PDT) Received: from uni.. (adsl-146.37.6.170.tellas.gr. [37.6.170.146]) by smtp.googlemail.com with ESMTPSA id g4-20020a170906868400b006fee98045cdsm8834469ejx.10.2022.06.29.23.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 23:40:13 -0700 (PDT) From: Xenia Ragiadakou To: will@kernel.org, joro@8bytes.org, robin.murphy@arm.com Cc: linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Xenia Ragiadakou Subject: [PATCH] iommu/arm-smmu-v3: Fix undefined behavior in GBPA_UPDATE Date: Thu, 30 Jun 2022 09:39:59 +0300 Message-Id: <20220630063959.27226-1-burzalodowa@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220629_234019_209781_458988F8 X-CRM114-Status: GOOD ( 12.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The expression 1 << 31 results in undefined behaviour because the type of integer constant 1 is (signed) int and the result of shifting 1 by 31 bits is not representable in the (signed) int type. Change the type of 1 to unsigned int by adding the U suffix. Signed-off-by: Xenia Ragiadakou --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h index cd48590ada30..44fbd499edea 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h @@ -96,7 +96,7 @@ #define CR2_E2H (1 << 0) #define ARM_SMMU_GBPA 0x44 -#define GBPA_UPDATE (1 << 31) +#define GBPA_UPDATE (1U << 31) #define GBPA_ABORT (1 << 20) #define ARM_SMMU_IRQ_CTRL 0x50