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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iJRDN=pzkBTqhJipnsDpqPS5ehxWUcKJ3RXAR2=hkD-Q@mail.gmail.com>
Date:   Mon, 11 Dec 2023 21:58:44 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     ZhouJie <zhoujie@...china.com>
Cc:     rafael@...nel.org, pavel@....cz, len.brown@...el.com,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] power: main: Remove unnecessary ‘NULL’ initialization from last_failed_step_show()

On Fri, Oct 20, 2023 at 10:38 AM ZhouJie <zhoujie@...china.com> wrote:
>
> Declaring char *last_failed_step; is reasonable because you can later
> assign the function's return value to last_failed_step without
> explicitly assigning an initial value.

Did you want to say something like "it is not necessary to initialize
last_failed_step to NULL, because it is never read before being
assigned a value" ?

Also, to my eyes, last_failed_step is redundant and can be dropped
from that function entirely.

> Signed-off-by: ZhouJie <zhoujie@...china.com>
> ---
>  kernel/power/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index f6425ae3e8b05..24c675f6ab862 100644
> --- a/kernel/power/main.c
> +++ b/kernel/power/main.c
> @@ -410,7 +410,7 @@ static ssize_t last_failed_step_show(struct kobject *kobj,
>  {
>         int index;
>         enum suspend_stat_step step;
> -       char *last_failed_step = NULL;
> +       char *last_failed_step;
>
>         index = suspend_stats.last_failed_step + REC_FAILED_NUM - 1;
>         index %= REC_FAILED_NUM;
> --
> 2.18.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ