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: <aR0s653C4g2auavf@swlinux02>
Date: Wed, 19 Nov 2025 10:35:23 +0800
From: CL Wang <cl634@...estech.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
CC: Alexandre Belloni <alexandre.belloni@...tlin.com>,
        <linux-rtc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <kernel-janitors@...r.kernel.org>, <cl634@...estech.com>
Subject: Re: [PATCH next] rtc: atcrtc100: Fix signedness bug in probe()

On Tue, Nov 18, 2025 at 01:48:56PM +0300, Dan Carpenter wrote:

Hi Dan,

Thank you for pointing out the issue and for providing the fix.

You're absolutely correct that using an unsigned type for alarm_irq
prevents proper error handling when platform_get_irq() returns a
negative value. I will apply your patch and also review other return
value checks to ensure there are no similar issues elsewhere.

Thank you again for your detailed review and suggestions.

Best regards,
CL

> 
> The "atcrtc_dev->alarm_irq" variable is an unsigned int but it needs to
> be signed for the error handling to work.  Use the "ret" variable
> instead.
> 
> Fixes: 7adca706fe16 ("rtc: atcrtc100: Add ATCRTC100 RTC driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  drivers/rtc/rtc-atcrtc100.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-atcrtc100.c b/drivers/rtc/rtc-atcrtc100.c
> index 51933ae1a2fa..9808fc2c5a49 100644
> --- a/drivers/rtc/rtc-atcrtc100.c
> +++ b/drivers/rtc/rtc-atcrtc100.c
> @@ -296,10 +296,12 @@ static int atcrtc_probe(struct platform_device *pdev)
>                                      "Failed to initialize RTC: unsupported hardware ID 0x%x\n",
>                                      rtc_id);
> 
> -       atcrtc_dev->alarm_irq = platform_get_irq(pdev, 1);
> -       if (atcrtc_dev->alarm_irq < 0)
> -               return dev_err_probe(&pdev->dev, atcrtc_dev->alarm_irq,
> +       ret = platform_get_irq(pdev, 1);
> +       if (ret < 0)
> +               return dev_err_probe(&pdev->dev, ret,
>                                      "Failed to get IRQ for alarm\n");
> +       atcrtc_dev->alarm_irq = ret;
> +
>         ret = devm_request_irq(&pdev->dev,
>                                atcrtc_dev->alarm_irq,
>                                atcrtc_alarm_isr,
> --
> 2.51.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ