From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E1F2C433E0 for ; Thu, 4 Feb 2021 15:47:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E950E64DA5 for ; Thu, 4 Feb 2021 15:47:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237515AbhBDPq4 (ORCPT ); Thu, 4 Feb 2021 10:46:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:34012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237446AbhBDPqJ (ORCPT ); Thu, 4 Feb 2021 10:46:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 39B5864F4A; Thu, 4 Feb 2021 15:45:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612453527; bh=lI0HC3GQbRFgXxSEIB/73Da0jQE/c8jAVtTEPB7vO28=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hw7jGjaOFkLAvQ61LL+VxqPi61iCFS1TZYi2B+cwgM1q3w4+wR4x7emm3TtBViZSm 2GrhUdgflJlyA+3u1JkgT7g8skKX5b+ttzIYkKYfQUS0BUV02aYO6Vu9aMuWtT+a/J HYXBSDBHv3esRV8xFzPZ0ZZsEwLG6E7+g0tJKRYthwIUBadcNIZ4Nl+Fc5PzKNxBkS P4ep96lwNbV642I7ry+o7/5eT0bzGj2Is8PseM6TWB5lR91u2uVlVK+KG6Guhsy/Mx FHr2kz+NeXH4zrLOD04Eq42qyz8QOF9S1LNXYEOhfHwN0aDczIa6cgbUbFdj5jW86r Sgee71aeHeEGQ== Date: Thu, 4 Feb 2021 15:45:23 +0000 From: Will Deacon To: Colin King Cc: Joerg Roedel , Matthias Brugger , 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][V2] iommu/mediatek: Fix unsigned domid comparison with less than zero Message-ID: <20210204154522.GD21058@willie-the-truck> References: <20210204150001.102672-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210204150001.102672-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 Thu, Feb 04, 2021 at 03:00:01PM +0000, Colin King wrote: > From: Colin Ian King > > Currently the check for domid < 0 is always false because domid > is unsigned. Fix this by casting domid to an int before making > the comparison. > > Addresses-Coverity: ("Unsigned comparison against 0") > Signed-off-by: Colin Ian King > --- > > V2: cast domid rather than making it an int. Replace L with : in > the commit message. > > --- > 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..1f262621ef19 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -645,7 +645,7 @@ static void mtk_iommu_get_resv_regions(struct device *dev, > struct iommu_resv_region *region; > int prot = IOMMU_WRITE | IOMMU_READ; > > - if (domid < 0) > + if ((int)domid < 0) > return; > curdom = data->plat_data->iova_region + domid; > for (i = 0; i < data->plat_data->iova_region_nr; i++) { Thanks, Colin. Acked-by: Will Deacon Will