Re: [PATCH] ext4: extents: Remove unnecessary ‘NULL’ values from path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux