Linux-ext4 Archive mirror
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Li zeming <zeming@nfschina.com>
Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext4: extents: Remove unnecessary ‘NULL’ values from path
Date: Mon, 1 Apr 2024 23:55:02 -0400	[thread overview]
Message-ID: <20240402035502.GC1189142@mit.edu> (raw)
In-Reply-To: <20240402024140.28456-1-zeming@nfschina.com>

On Tue, Apr 02, 2024 at 10:41:40AM +0800, Li zeming wrote:
> path is assigned first, so it does not need to initialize the
> assignment.

That's technically true, but the compiler is perfectly capable of
optimizing it out.  So it's harmless, and removing it does make the
code a bit more fragile, since it needs to be set so that the cleanup
code doesn't accidentally dereference an uninitialized pointer:

out:
	up_read(&ei->i_data_sem);
	ext4_free_ext_path(path);
	return ret;


So if later on, we add code which does a "goto out" on an error,
before path gets initialized, that would be bad.  So removing the
"unnecessary" set has no upside, and it has a potential disadvantage.


	      	      	 	     - Ted

      reply	other threads:[~2024-04-02  3:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  2:41 [PATCH] ext4: extents: Remove unnecessary ‘NULL’ values from path Li zeming
2024-04-02  3:55 ` Theodore Ts'o [this message]

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=20240402035502.GC1189142@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zeming@nfschina.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).