linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: harshad shirwadkar <harshadshirwadkar@gmail.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 4/4] e2fsck: initialize variable before first use in fast commit replay
Date: Tue, 23 Feb 2021 09:41:05 -0800	[thread overview]
Message-ID: <CAD+ocbwro-Zu9O60QQFTZ2CvQtdyZN19_X3bghFyxJS=hChStg@mail.gmail.com> (raw)
In-Reply-To: <YDLpPr/DD/sSRuES@mit.edu>

Thanks Ted, it makes sense, will fix this in V2.

- Harshad

On Sun, Feb 21, 2021 at 3:14 PM Theodore Ts'o <tytso@mit.edu> wrote:
>
> On Fri, Feb 19, 2021 at 01:03:33PM -0800, Harshad Shirwadkar wrote:
> > From: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
> >
> > Initialize ext2fs_ex variable in ext4_fc_replay_scan() before first
> > use.
> >
> > Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
>
> I wonder if we should make the following change to
> ext2fs_decode_extent(), which will prevent other future bugs to
> potential users of the function:
>
>         to->e_pblk = ext2fs_le32_to_cpu(from->ee_start) +
>                 ((__u64) ext2fs_le16_to_cpu(from->ee_start_hi)
>                         << 32);
>         to->e_lblk = ext2fs_le32_to_cpu(from->ee_block);
>         to->e_len = ext2fs_le16_to_cpu(from->ee_len);
> -       to->e_flags |= EXT2_EXTENT_FLAGS_LEAF;
> +       to->e_flags = EXT2_EXTENT_FLAGS_LEAF;
>
> ext2fs_decode_extent() overwrites all other members of the structure,
> so we might as well just initialize e_flags as opposed to depending
> the caller to initiaize *to just for the sake of to->e_flags.
>
> Cheers,
>
>                                         - Ted

  reply	other threads:[~2021-02-23 17:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 21:03 [PATCH 1/4] e2fsck: don't ignore return values in e2fsck_rewrite_extent_tree Harshad Shirwadkar
2021-02-19 21:03 ` [PATCH 2/4] ext2fs: don't ignore return value in ext2fs_count_blocks Harshad Shirwadkar
2021-02-19 21:03 ` [PATCH 3/4] e2fsck: add fallthrough comment in fc replay switch case Harshad Shirwadkar
2021-02-19 21:03 ` [PATCH 4/4] e2fsck: initialize variable before first use in fast commit replay Harshad Shirwadkar
2021-02-21 23:14   ` Theodore Ts'o
2021-02-23 17:41     ` harshad shirwadkar [this message]
2021-02-20  8:58 ` [PATCH 1/4] e2fsck: don't ignore return values in e2fsck_rewrite_extent_tree Благодаренко Артём
2021-02-23 17:40   ` harshad shirwadkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD+ocbwro-Zu9O60QQFTZ2CvQtdyZN19_X3bghFyxJS=hChStg@mail.gmail.com' \
    --to=harshadshirwadkar@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).