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]
Date:   Sat, 10 Jun 2023 14:20:10 +0200
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Li zeming <zeming@...china.com>, jstultz@...gle.com,
        sboyd@...nel.org
Cc:     linux-kernel@...r.kernel.org, Li zeming <zeming@...china.com>
Subject: Re: [PATCH] time: alarmtimer: Optimization function return value

On Sat, Jun 10 2023 at 02:09, Li zeming wrote:
>  	if (!test_bit(RTC_FEATURE_ALARM, rtc->features))
> -		return -1;
> +		return -EPERM;

I know you are only replacing the -1, but EPERM does not make any sense
here. It's not a permission problem, it's the lack of a feature. So the
proper code is -ENODEV.

>  	if (!device_may_wakeup(rtc->dev.parent))
> -		return -1;
> +		return -EPERM;

Ditto
 
>  	pdev = platform_device_register_data(dev, "alarmtimer",
>  					     PLATFORM_DEVID_AUTO, NULL, 0);
> @@ -104,7 +104,7 @@ static int alarmtimer_rtc_add_device(struct device *dev)
>  	spin_lock_irqsave(&rtcdev_lock, flags);
>  	if (!IS_ERR(pdev) && !rtcdev) {
>  		if (!try_module_get(rtc->owner)) {
> -			ret = -1;
> +			ret = -EPERM;

Same here.

But this error case is broken because it does not undo the

     device_init_wakeup(&pdev->dev, true);

So this needs

+  		device_init_wakeup(&pdev->dev, false);

before the goto

>  			goto unlock;
>  		}
>  
> @@ -113,7 +113,7 @@ static int alarmtimer_rtc_add_device(struct device *dev)
>  		get_device(dev);
>  		pdev = NULL;
>  	} else {
> -		ret = -1;
> +		ret = -EPERM;

                ENODEV

>  	}

So please do not blindly replace something without actually analysing
it. There is a reason why these things are not just "fixed" with a
script.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ