Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp299592pxb; Wed, 3 Feb 2021 06:03:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtF/0q+6BDWgwBkglVgtpo1yKMbomWsa2XPJavgFAkT6IL5gmv6G43041L4XsEGyqpTAQ5 X-Received: by 2002:a17:906:7006:: with SMTP id n6mr3276635ejj.35.1612361023118; Wed, 03 Feb 2021 06:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612361023; cv=none; d=google.com; s=arc-20160816; b=XPTFYjpEZML59RP3lmj7j+qmkTnn8btU+ZBkSVZ+feKjxAf9Zbbf1cLmCfurWIoCWh 0Famm7hWCsth2SgsREFblYv/A6gNbztyRD9RIoU7WamUD0PXGn7RpObcrhBZT08kH2Ke FM5OTmBeBXxnHPg57W3FsRVILjSZ/Erz8DflrfrR4nBI+JZD9Dz+bfxMPG03jIbXpVSo uRd8M9B+21VQOW8pV3LZjZCBYExxwD50z+IDVEDQ7JyZY0qy4Fnax2hJ3JqkX52/iVsO 4vG0NMvNd8tea51e6Pmi9Hw0aH/YMQD0/sU1nnvnx1qoF0cjPG0MYA6nBzzq8fLHcfuM sLVw== 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 :message-id:date:subject:cc:to:from; bh=SgmyD66OL0Jezp0qXjnZEkwb+Er7EuXxCbS4MYnXJec=; b=tCyFUyip3/l6KEfgvCE1HTuMrDGBLRZex29wMMTfSaLBBdS2DgoeTa/lwQeG3LexIH eTe5H5JgEP1wfpfQ6FAyczmAnXwgNGL91zk3Tv1kT/DiyO55xFpynjXESIq7hKGUfPdO dYFgZXpIlHHFky3OjYgAssAsWRDJmlA55K9smIK3pdyGCSZH+m1thWAa3VSSPRhFMlFJ q1Iejjx8Y8arEcUaghwUQ9UWne6KjkekxYwGr90zjlrx6QPZuiuOG4dsYRPSvzNUuOd0 3J51eF/G2OwGF8pWh7zU4FgcLXshuL7w/p2u1NIfUf0Y+1sgpeWtvcfKoCgTHmZwwmzw yDmg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn17si1346709ejc.676.2021.02.03.06.03.04; Wed, 03 Feb 2021 06:03:43 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232467AbhBCOBR (ORCPT + 99 others); Wed, 3 Feb 2021 09:01:17 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:37822 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231587AbhBCOA0 (ORCPT ); Wed, 3 Feb 2021 09:00:26 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l7Igz-0001Ml-6C; Wed, 03 Feb 2021 13:59:37 +0000 From: Colin King To: Joerg Roedel , Will Deacon , Matthias Brugger , Anan sun , Yong Wu , Chao Hao , Tomasz Figa , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] iommu/mediatek: Fix unsigned domid comparison with less than zero Date: Wed, 3 Feb 2021 13:59:36 +0000 Message-Id: <20210203135936.23016-1-colin.king@canonical.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently the check for domid < 0 is always false because domid is unsigned. Fix this by making it signed. Addresses-CoverityL ("Unsigned comparison against 0") Fixes: ab1d5281a62b ("iommu/mediatek: Add iova reserved function") Signed-off-by: Colin Ian King --- drivers/iommu/mtk_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 0ad14a7604b1..823d719945b2 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -640,7 +640,7 @@ static void mtk_iommu_get_resv_regions(struct device *dev, struct list_head *head) { struct mtk_iommu_data *data = dev_iommu_priv_get(dev); - unsigned int domid = mtk_iommu_get_domain_id(dev, data->plat_data), i; + int domid = mtk_iommu_get_domain_id(dev, data->plat_data), i; const struct mtk_iommu_iova_region *resv, *curdom; struct iommu_resv_region *region; int prot = IOMMU_WRITE | IOMMU_READ; -- 2.29.2