Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1114097pxb; Thu, 4 Feb 2021 05:36:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuDHJ9D6/g5nQ13XjUfYpBvGIswhXHMMSuEZbCLRUYWzW77MZg7FR/z1Gpob8qaqOupTw/ X-Received: by 2002:a50:ec8f:: with SMTP id e15mr2587839edr.79.1612445768494; Thu, 04 Feb 2021 05:36:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612445768; cv=none; d=google.com; s=arc-20160816; b=SbIF+vcbrNuRXZiQ8mQaGs/BUs+8qBWG4l5N5JNGDQ5pHFAuzwTMujSxBk67Sgv8Em saEAEpqFDNztNXSgBMW9kjxPslOGIbhWC846jII6WKsxMIL2KiYHTYsWAhAA4F9Q1MNG xLk6yS1yamJzisZH9ZZ/60FgVI7OslyYE03IOk/O4FQKmun3NmFBr1phOJinrkuVPvDd U/snokchxbRoOVrLVV5XPU7yWxHwqSYtenrK3jQcbo2KDB/Zi0Tjs7e/x26ZQr9SStP7 QWlJp10lm2q0Whbnq+57Cx5q+48tdh1xmld6DxunmBW9YSRFrhVQL6Kl6553DRPjYgkA PbjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=BINPeyQEMbAsEKRz5DH8DjHQQ28miHLikZjQsXtHfPU=; b=GXPM4hZPLnRSe/+6wNyWzpUCmOdg0rOoYVQC5bsoMz1N/BZq9ucVkr2aeAWWdPTQlv eRCKBaS8uWnAt22L0mNAhXCSfQ+HA69th19IzUHxXHHt5dpSLh7b/Xgq1ooJuKhUWUDF 3/wBmlysXiVgF4VWr1c6PgGZZBlSwWbD6RcsCYK76d88twUO6G41rPpCTqQf/acJp5JC Auwn7AU5hgbiKFH+Ni/uO/GYd9X81FUzh3KBZIyEcluNCEJAZmDDvMNkuuoPv4eY7dNz XRVC/+mBUQUJ/1Gmswo/1rJgbNtLuwKCYO60dfDhQFL6i5jtIenOjYFxozGIZnw9IHOl zAwg== 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=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp21si3082321ejc.108.2021.02.04.05.35.41; Thu, 04 Feb 2021 05:36:08 -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=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236273AbhBDNco (ORCPT + 99 others); Thu, 4 Feb 2021 08:32:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235605AbhBDNcl (ORCPT ); Thu, 4 Feb 2021 08:32:41 -0500 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 970A5C061573 for ; Thu, 4 Feb 2021 05:31:59 -0800 (PST) Received: by theia.8bytes.org (Postfix, from userid 1000) id 8F0DE387; Thu, 4 Feb 2021 14:31:55 +0100 (CET) Date: Thu, 4 Feb 2021 14:31:48 +0100 From: Joerg Roedel To: Will Deacon Cc: Colin King , 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, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] iommu/mediatek: Fix unsigned domid comparison with less than zero Message-ID: <20210204133148.GA27686@8bytes.org> References: <20210203135936.23016-1-colin.king@canonical.com> <20210204092558.GA20244@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210204092558.GA20244@willie-the-truck> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2021 at 09:25:58AM +0000, Will Deacon wrote: > On Wed, Feb 03, 2021 at 01:59:36PM +0000, Colin King wrote: > > 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") > > Typo here ('L' instead of ':') > > > 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; > > Not sure if it's intentional, but this also makes 'i' signed. It probably > should remain 'unsigned' to match 'iova_region_nr' in > 'struct mtk_iommu_plat_data'. Yes, 'i' should stay unsigned. Colin, can you please fix that up and re-send? Thanks, Joerg