From: Will Deacon <will@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Joerg Roedel <joro@8bytes.org>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
iommu@lists.linux-foundation.org,
linux-mediatek@lists.infradead.org,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH][next][V2] iommu/mediatek: Fix unsigned domid comparison with less than zero
Date: Thu, 4 Feb 2021 15:45:23 +0000 [thread overview]
Message-ID: <20210204154522.GD21058@willie-the-truck> (raw)
In-Reply-To: <20210204150001.102672-1-colin.king@canonical.com>
On Thu, Feb 04, 2021 at 03:00:01PM +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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 <colin.king@canonical.com>
> ---
>
> 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@kernel.org>
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-02-04 15:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-04 15:00 [PATCH][next][V2] iommu/mediatek: Fix unsigned domid comparison with less than zero Colin King
2021-02-04 15:45 ` Will Deacon [this message]
2021-02-05 8:50 ` Joerg Roedel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210204154522.GD21058@willie-the-truck \
--to=will@kernel.org \
--cc=colin.king@canonical.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox