Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp968284pxb; Thu, 4 Feb 2021 01:29:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZJ0TU+mKh96ToheZA4Ey6hlTWxWxDNPdJ1mee1o0rbarQGgtVHLLCjHLxb2Xd24N4wsDG X-Received: by 2002:a05:6402:61a:: with SMTP id n26mr6751414edv.51.1612430957722; Thu, 04 Feb 2021 01:29:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612430957; cv=none; d=google.com; s=arc-20160816; b=ihEgyPkz5YlfMEV24/9Y9P+RAJxmHjMKBkDYECg0sqrtcx0H8IHuMit/N1LTV+zQBj KgGJOZrf89yk4tJ9Dp5Nu93pREAxf4vhVxo1fUq0gzPF6XNhYc94/fkjLBy2UDAFXpOk bBvoncaYxDTPsLfXc5Hlj75zyuI5hE0M5nURggNNVMAw6ZKK/i4mrwq3ndBSjnzlXW1w nnKOlNV0pSE5u8/DMBrLH2QHUzBAH89nKlGMbZvR1CGXcbra5hE8Dfn+EzTSv1jR0s8c lZ8iuXV5+ffZLmKjcKtE3WYkBkLWjwfPpuoxG0rchs5YtEqOtut1sQbw8AJPTjEyRago pumw== 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 :dkim-signature; bh=w/ZiSksFadrNef7L2IB+NlAwyFWxbeZYDEtgnS5BdtE=; b=UcLW55QaHro1WaYrYK3TKKnSHe4a/PL80XZYI4nPo1qOSaDF0lB2xrXjjb67QzuF0G HaqbcpEeT+21rfkpFHdU8HToF9ZBOqQkFPR9CkDBdqJJcwanaZPP9TBRxOP2g/5ruUG/ C2jRjM4nzDaChiVoScE4mPDq+mXjM0SvrZxHMs6C6jA2TIzE8cACVI/ltNbsKcHehnDc HTJPCDk7m19wlT1qDVfz3fcJZscpeKl2NNBWNng1QpJfdrppBL3GAYXVWYpc0wXV+Tbn ACw4PatQt9LVbSkDyyiLftVuicWzCBt74eIG5CBaAISfzRwLjWDuHFyE6Er4qcZUTdxS mx1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pWSNLJIt; 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 g17si2937732edb.473.2021.02.04.01.28.53; Thu, 04 Feb 2021 01:29:17 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pWSNLJIt; 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 S235211AbhBDJ0r (ORCPT + 99 others); Thu, 4 Feb 2021 04:26:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:58832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234620AbhBDJ0p (ORCPT ); Thu, 4 Feb 2021 04:26:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2B8A964F48; Thu, 4 Feb 2021 09:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612430764; bh=iPr0CA2pIHDHh2dXkae4rNvFekouTDxQFLqezinvrzI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pWSNLJIttnbgsu3Ltschs2qhIDAn3WsWGlCpTGDn5YCZSXTbF+ZoZJYp0uzRXGLOU tEkRiLiu80c4yGmWLO8kZbRsZ+ye9vUeOtYUWDa1aDk11OOplr9Z86NsjPVDmZlVFV 62t8B3MrYdVi37kaqdN5IqTn8aVW6QFgVn6hlKoeiEKsQGjw+RNmZtUdsac/7qvYsG AHseRnGyZ9DloI+Ng/A6MPwGv6q8duHiDS5+0rIOv2Bj5rWl+XqbxC5pmGwORXlqkY dHcM2nOLZyKERvGRzkEWss4zBUQe6q9y7H4Oca3P3p2GswRWxJfqy5QbZG6UmA3syV 7BbxUlIPU5i+w== Date: Thu, 4 Feb 2021 09:25:58 +0000 From: Will Deacon To: Colin King Cc: Joerg Roedel , 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: <20210204092558.GA20244@willie-the-truck> References: <20210203135936.23016-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210203135936.23016-1-colin.king@canonical.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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'. Will