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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFLxGvzAncnBTEbHZ0pA-oF6n9P+wKFMugz8c+8UQKoPeBiYig@mail.gmail.com>
Date: Fri, 5 Jan 2024 16:55:11 +0100
From: Richard Weinberger <richard.weinberger@...il.com>
To: Kunwu Chan <chentao@...inos.cn>
Cc: richard@....at, Artem.Bityutskiy@...ia.com, kunwu.chan@...mail.com, 
	linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ubifs: Remove unreachable code

On Sat, Nov 11, 2023 at 3:33 PM Kunwu Chan <chentao@...inos.cn> wrote:
>
> Because there is no break statement in the dead loop above,it is
> impossible to execute the 'err=0' statement.Delete the code that
> will never execute and initialize 'err' at the start of the function.
>
> Fixes: 6fb324a4b0c3 ("UBIFS: allocate ltab checking buffer on demand")
> Signed-off-by: Kunwu Chan <chentao@...inos.cn>
> ---
>  fs/ubifs/lpt_commit.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
> index c4d079328b92..d4751628fe70 100644
> --- a/fs/ubifs/lpt_commit.c
> +++ b/fs/ubifs/lpt_commit.c
> @@ -1589,8 +1589,8 @@ static int dbg_is_node_dirty(struct ubifs_info *c, int node_type, int lnum,
>   */
>  static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
>  {
> -       int err, len = c->leb_size, dirty = 0, node_type, node_num, node_len;
> -       int ret;
> +       int len = c->leb_size, dirty = 0, node_type, node_num, node_len;
> +       int ret, err = 0;
>         void *buf, *p;

Now it is still dead code.
A few lines later err will be used for the result of ubifs_leb_read().
So you can remove the initialization of err completely.

>         if (!dbg_is_chk_lprops(c))
> @@ -1646,7 +1646,6 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum)
>                 len -= node_len;
>         }
>
> -       err = 0;
>  out:
>         vfree(buf);
>         return err;
> --
> 2.34.1
>


-- 
Thanks,
//richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ