lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <KUZPR04MB92652A9F33B1EA2A2CFF51C4F3B3A@KUZPR04MB9265.apcprd04.prod.outlook.com>
Date: Thu, 25 Dec 2025 12:32:37 +0800
From: "Nutty.Liu" <nutty.liu@...mail.com>
To: Alper Ak <alperyasinak1@...il.com>, tjeznach@...osinc.com
Cc: Dan Carpenter <error27@...il.com>, Joerg Roedel <joro@...tes.org>,
 Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
 Paul Walmsley <pjw@...nel.org>, Palmer Dabbelt <palmer@...belt.com>,
 Albert Ou <aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>,
 iommu@...ts.linux.dev, linux-riscv@...ts.infradead.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommu/riscv: Fix unsigned comparison with negative error
 code


On 12/22/2025 11:15 PM, Alper Ak wrote:
> platform_irq_count() can return -EPROBE_DEFER, but irqs_count is
> unsigned. This causes the negative value to wrap around and bypass
> the error check.
>
> Store the return value in a signed integer first and check for
> errors before assigning to irqs_count.
>
> Reported-by: Dan Carpenter <error27@...il.com>
> Closes: https://lore.kernel.org/r/202512141551.kZLTle5r-lkp@intel.com/
> Signed-off-by: Alper Ak <alperyasinak1@...il.com>
> ---
>   drivers/iommu/riscv/iommu-platform.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
Reviewed-by: Nutty Liu <nutty.liu@...mail.com>

Thanks,
Nutty
> diff --git a/drivers/iommu/riscv/iommu-platform.c b/drivers/iommu/riscv/iommu-platform.c
> index 83a28c83f991..5ec8efedbf12 100644
> --- a/drivers/iommu/riscv/iommu-platform.c
> +++ b/drivers/iommu/riscv/iommu-platform.c
> @@ -68,8 +68,13 @@ static int riscv_iommu_platform_probe(struct platform_device *pdev)
>   	iommu->caps = riscv_iommu_readq(iommu, RISCV_IOMMU_REG_CAPABILITIES);
>   	iommu->fctl = riscv_iommu_readl(iommu, RISCV_IOMMU_REG_FCTL);
>   
> -	iommu->irqs_count = platform_irq_count(pdev);
> -	if (iommu->irqs_count <= 0)
> +	ret = platform_irq_count(pdev);
> +	if (ret < 0)
> +		return ret;
> +
> +	iommu->irqs_count = ret;
> +
> +	if (!iommu->irqs_count)
>   		return dev_err_probe(dev, -ENODEV,
>   				     "no IRQ resources provided\n");
>   	if (iommu->irqs_count > RISCV_IOMMU_INTR_COUNT)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ