linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: ext4: fix uninitialized symbols
@ 2025-10-08 17:16 Ranganath V N
  2025-10-10 18:31 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Ranganath V N @ 2025-10-08 17:16 UTC (permalink / raw)
  To: tytso, adilger.kernel
  Cc: linux-ext4, linux-kernel, linux-kernel-mentees, skhan,
	david.hunter.linux, khalid, Ranganath V N

Fix the issue detected by the smatch tool.

fs/ext4/inode.c:3583 ext4_map_blocks_atomic_write_slow() error: uninitialized symbol 'next_pblk'.
fs/ext4/namei.c:1776 ext4_lookup() error: uninitialized symbol 'de'.
fs/ext4/namei.c:1829 ext4_get_parent() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3162 ext4_rmdir() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3242 __ext4_unlink() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3697 ext4_find_delete_entry() error: uninitialized symbol 'de'.

Tested with compilation only.
These changes enhance code clarity, address static analysis tool errors.

Signed-off-by: Ranganath V N <vnranganath.20@gmail.com>
---
 fs/ext4/inode.c |  2 +-
 fs/ext4/namei.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5b7a15db4953..792b88522916 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3544,7 +3544,7 @@ static int ext4_map_blocks_atomic_write_slow(handle_t *handle,
 	ext4_lblk_t m_lblk = map->m_lblk;
 	unsigned int m_len = map->m_len;
 	unsigned int mapped_len = 0, m_flags = 0;
-	ext4_fsblk_t next_pblk;
+	ext4_fsblk_t next_pblk = NULL;
 	bool check_next_pblk = false;
 	int ret = 0;
 
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 2cd36f59c9e3..045616033515 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1762,7 +1762,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
 static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 {
 	struct inode *inode;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 	struct buffer_head *bh;
 
 	if (dentry->d_name.len > EXT4_NAME_LEN)
@@ -1818,7 +1818,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
 struct dentry *ext4_get_parent(struct dentry *child)
 {
 	__u32 ino;
-	struct ext4_dir_entry_2 * de;
+	struct ext4_dir_entry_2 * de = NULL;
 	struct buffer_head *bh;
 
 	bh = ext4_find_entry(d_inode(child), &dotdot_name, &de, NULL);
@@ -3133,7 +3133,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
 	int retval;
 	struct inode *inode;
 	struct buffer_head *bh;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 	handle_t *handle = NULL;
 
 	retval = ext4_emergency_state(dir->i_sb);
@@ -3224,7 +3224,7 @@ int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
 {
 	int retval = -ENOENT;
 	struct buffer_head *bh;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 	handle_t *handle;
 	int skip_remove_dentry = 0;
 
@@ -3688,7 +3688,7 @@ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir,
 {
 	int retval = -ENOENT;
 	struct buffer_head *bh;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 
 	bh = ext4_find_entry(dir, d_name, &de, NULL);
 	if (IS_ERR(bh))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] fs: ext4: fix uninitialized symbols
  2025-10-08 17:16 [PATCH] fs: ext4: fix uninitialized symbols Ranganath V N
@ 2025-10-10 18:31 ` kernel test robot
  2025-10-10 18:41 ` kernel test robot
  2025-10-11  7:48 ` [PATCH] " kernel test robot
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-10-10 18:31 UTC (permalink / raw)
  To: Ranganath V N, tytso, adilger.kernel
  Cc: oe-kbuild-all, linux-ext4, linux-kernel, linux-kernel-mentees,
	skhan, david.hunter.linux, khalid, Ranganath V N

Hi Ranganath,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tytso-ext4/dev]
[also build test WARNING on linus/master v6.17 next-20251010]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ranganath-V-N/fs-ext4-fix-uninitialized-symbols/20251010-065232
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
patch link:    https://lore.kernel.org/r/20251008171614.12129-1-vnranganath.20%40gmail.com
patch subject: [PATCH] fs: ext4: fix uninitialized symbols
config: sparc-randconfig-002-20251010 (https://download.01.org/0day-ci/archive/20251011/202510110215.0tTIOF83-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251011/202510110215.0tTIOF83-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510110215.0tTIOF83-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/kasan-checks.h:5,
                    from include/asm-generic/rwonce.h:26,
                    from ./arch/sparc/include/generated/asm/rwonce.h:1,
                    from include/linux/compiler.h:382,
                    from arch/sparc/include/asm/bug.h:6,
                    from include/linux/bug.h:5,
                    from include/linux/vfsdebug.h:5,
                    from include/linux/fs.h:5,
                    from fs/ext4/inode.c:22:
   fs/ext4/inode.c: In function 'ext4_map_blocks_atomic_write_slow':
>> include/linux/stddef.h:8:14: warning: initialization of 'ext4_fsblk_t' {aka 'long long unsigned int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
    #define NULL ((void *)0)
                 ^
   fs/ext4/inode.c:3547:27: note: in expansion of macro 'NULL'
     ext4_fsblk_t next_pblk = NULL;
                              ^~~~
--
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/kasan-checks.h:5,
                    from include/asm-generic/rwonce.h:26,
                    from arch/sparc/include/generated/asm/rwonce.h:1,
                    from include/linux/compiler.h:382,
                    from arch/sparc/include/asm/bug.h:6,
                    from include/linux/bug.h:5,
                    from include/linux/vfsdebug.h:5,
                    from include/linux/fs.h:5,
                    from inode.c:22:
   inode.c: In function 'ext4_map_blocks_atomic_write_slow':
>> include/linux/stddef.h:8:14: warning: initialization of 'ext4_fsblk_t' {aka 'long long unsigned int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
    #define NULL ((void *)0)
                 ^
   inode.c:3547:27: note: in expansion of macro 'NULL'
     ext4_fsblk_t next_pblk = NULL;
                              ^~~~


vim +8 include/linux/stddef.h

^1da177e4c3f41 Linus Torvalds   2005-04-16  6  
^1da177e4c3f41 Linus Torvalds   2005-04-16  7  #undef NULL
^1da177e4c3f41 Linus Torvalds   2005-04-16 @8  #define NULL ((void *)0)
6e218287432472 Richard Knutsson 2006-09-30  9  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fs: ext4: fix uninitialized symbols
  2025-10-08 17:16 [PATCH] fs: ext4: fix uninitialized symbols Ranganath V N
  2025-10-10 18:31 ` kernel test robot
@ 2025-10-10 18:41 ` kernel test robot
  2025-10-11  6:38   ` [PATCH v2] " Ranganath V N
  2025-10-11  7:48 ` [PATCH] " kernel test robot
  2 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2025-10-10 18:41 UTC (permalink / raw)
  To: Ranganath V N, tytso, adilger.kernel
  Cc: oe-kbuild-all, linux-ext4, linux-kernel, linux-kernel-mentees,
	skhan, david.hunter.linux, khalid, Ranganath V N

Hi Ranganath,

kernel test robot noticed the following build errors:

[auto build test ERROR on tytso-ext4/dev]
[also build test ERROR on linus/master v6.17 next-20251010]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ranganath-V-N/fs-ext4-fix-uninitialized-symbols/20251010-065232
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
patch link:    https://lore.kernel.org/r/20251008171614.12129-1-vnranganath.20%40gmail.com
patch subject: [PATCH] fs: ext4: fix uninitialized symbols
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20251011/202510110207.yBvUMr5Z-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251011/202510110207.yBvUMr5Z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510110207.yBvUMr5Z-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/objtool_types.h:7,
                    from include/linux/objtool.h:5,
                    from include/linux/instrumentation.h:7,
                    from arch/x86/include/asm/bug.h:6,
                    from include/linux/bug.h:5,
                    from include/linux/vfsdebug.h:5,
                    from include/linux/fs.h:5,
                    from fs/ext4/inode.c:22:
   fs/ext4/inode.c: In function 'ext4_map_blocks_atomic_write_slow':
>> include/linux/stddef.h:8:14: error: initialization of 'ext4_fsblk_t' {aka 'long long unsigned int'} from 'void *' makes integer from pointer without a cast [-Wint-conversion]
       8 | #define NULL ((void *)0)
         |              ^
   fs/ext4/inode.c:3547:34: note: in expansion of macro 'NULL'
    3547 |         ext4_fsblk_t next_pblk = NULL;
         |                                  ^~~~


vim +8 include/linux/stddef.h

^1da177e4c3f41 Linus Torvalds   2005-04-16  6  
^1da177e4c3f41 Linus Torvalds   2005-04-16  7  #undef NULL
^1da177e4c3f41 Linus Torvalds   2005-04-16 @8  #define NULL ((void *)0)
6e218287432472 Richard Knutsson 2006-09-30  9  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] fs: ext4: fix uninitialized symbols
  2025-10-10 18:41 ` kernel test robot
@ 2025-10-11  6:38   ` Ranganath V N
  2025-10-12 19:07     ` Theodore Ts'o
  2025-11-06 15:45     ` Theodore Ts'o
  0 siblings, 2 replies; 7+ messages in thread
From: Ranganath V N @ 2025-10-11  6:38 UTC (permalink / raw)
  To: lkp
  Cc: adilger.kernel, david.hunter.linux, khalid, linux-ext4,
	linux-kernel-mentees, linux-kernel, oe-kbuild-all, skhan, tytso,
	vnranganath.20

Fix the issue detected by the smatch tool.

fs/ext4/inode.c:3583 ext4_map_blocks_atomic_write_slow() error: uninitialized symbol 'next_pblk'.
fs/ext4/namei.c:1776 ext4_lookup() error: uninitialized symbol 'de'.
fs/ext4/namei.c:1829 ext4_get_parent() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3162 ext4_rmdir() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3242 __ext4_unlink() error: uninitialized symbol 'de'.
fs/ext4/namei.c:3697 ext4_find_delete_entry() error: uninitialized symbol 'de'.

These changes enhance code clarity, address static analysis tool errors.

Signed-off-by: Ranganath V N <vnranganath.20@gmail.com>
---

v2:
corrected the kernel test robot noticed build errors.

 fs/ext4/inode.c |  2 +-
 fs/ext4/namei.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5b7a15db4953..f20db3f4ef68 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3544,7 +3544,7 @@ static int ext4_map_blocks_atomic_write_slow(handle_t *handle,
 	ext4_lblk_t m_lblk = map->m_lblk;
 	unsigned int m_len = map->m_len;
 	unsigned int mapped_len = 0, m_flags = 0;
-	ext4_fsblk_t next_pblk;
+	ext4_fsblk_t next_pblk = 0;
 	bool check_next_pblk = false;
 	int ret = 0;
 
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 2cd36f59c9e3..045616033515 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1762,7 +1762,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
 static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
 {
 	struct inode *inode;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 	struct buffer_head *bh;
 
 	if (dentry->d_name.len > EXT4_NAME_LEN)
@@ -1818,7 +1818,7 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
 struct dentry *ext4_get_parent(struct dentry *child)
 {
 	__u32 ino;
-	struct ext4_dir_entry_2 * de;
+	struct ext4_dir_entry_2 * de = NULL;
 	struct buffer_head *bh;
 
 	bh = ext4_find_entry(d_inode(child), &dotdot_name, &de, NULL);
@@ -3133,7 +3133,7 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry)
 	int retval;
 	struct inode *inode;
 	struct buffer_head *bh;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 	handle_t *handle = NULL;
 
 	retval = ext4_emergency_state(dir->i_sb);
@@ -3224,7 +3224,7 @@ int __ext4_unlink(struct inode *dir, const struct qstr *d_name,
 {
 	int retval = -ENOENT;
 	struct buffer_head *bh;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 	handle_t *handle;
 	int skip_remove_dentry = 0;
 
@@ -3688,7 +3688,7 @@ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir,
 {
 	int retval = -ENOENT;
 	struct buffer_head *bh;
-	struct ext4_dir_entry_2 *de;
+	struct ext4_dir_entry_2 *de = NULL;
 
 	bh = ext4_find_entry(dir, d_name, &de, NULL);
 	if (IS_ERR(bh))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] fs: ext4: fix uninitialized symbols
  2025-10-08 17:16 [PATCH] fs: ext4: fix uninitialized symbols Ranganath V N
  2025-10-10 18:31 ` kernel test robot
  2025-10-10 18:41 ` kernel test robot
@ 2025-10-11  7:48 ` kernel test robot
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2025-10-11  7:48 UTC (permalink / raw)
  To: Ranganath V N, tytso, adilger.kernel
  Cc: oe-kbuild-all, linux-ext4, linux-kernel, linux-kernel-mentees,
	skhan, david.hunter.linux, khalid, Ranganath V N

Hi Ranganath,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tytso-ext4/dev]
[also build test WARNING on linus/master v6.17 next-20251010]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ranganath-V-N/fs-ext4-fix-uninitialized-symbols/20251010-065232
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
patch link:    https://lore.kernel.org/r/20251008171614.12129-1-vnranganath.20%40gmail.com
patch subject: [PATCH] fs: ext4: fix uninitialized symbols
config: i386-randconfig-063-20251011 (https://download.01.org/0day-ci/archive/20251011/202510111521.OLlwqh7d-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251011/202510111521.OLlwqh7d-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510111521.OLlwqh7d-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/ext4/inode.c:3547:34: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned long long [usertype] next_pblk @@     got void * @@
   fs/ext4/inode.c:3547:34: sparse:     expected unsigned long long [usertype] next_pblk
   fs/ext4/inode.c:3547:34: sparse:     got void *

vim +3547 fs/ext4/inode.c

  3540	
  3541	static int ext4_map_blocks_atomic_write_slow(handle_t *handle,
  3542				struct inode *inode, struct ext4_map_blocks *map)
  3543	{
  3544		ext4_lblk_t m_lblk = map->m_lblk;
  3545		unsigned int m_len = map->m_len;
  3546		unsigned int mapped_len = 0, m_flags = 0;
> 3547		ext4_fsblk_t next_pblk = NULL;
  3548		bool check_next_pblk = false;
  3549		int ret = 0;
  3550	
  3551		WARN_ON_ONCE(!ext4_has_feature_bigalloc(inode->i_sb));
  3552	
  3553		/*
  3554		 * This is a slow path in case of mixed mapping. We use
  3555		 * EXT4_GET_BLOCKS_CREATE_ZERO flag here to make sure we get a single
  3556		 * contiguous mapped mapping. This will ensure any unwritten or hole
  3557		 * regions within the requested range is zeroed out and we return
  3558		 * a single contiguous mapped extent.
  3559		 */
  3560		m_flags = EXT4_GET_BLOCKS_CREATE_ZERO;
  3561	
  3562		do {
  3563			ret = ext4_map_blocks(handle, inode, map, m_flags);
  3564			if (ret < 0 && ret != -ENOSPC)
  3565				goto out_err;
  3566			/*
  3567			 * This should never happen, but let's return an error code to
  3568			 * avoid an infinite loop in here.
  3569			 */
  3570			if (ret == 0) {
  3571				ret = -EFSCORRUPTED;
  3572				ext4_warning_inode(inode,
  3573					"ext4_map_blocks() couldn't allocate blocks m_flags: 0x%x, ret:%d",
  3574					m_flags, ret);
  3575				goto out_err;
  3576			}
  3577			/*
  3578			 * With bigalloc we should never get ENOSPC nor discontiguous
  3579			 * physical extents.
  3580			 */
  3581			if ((check_next_pblk && next_pblk != map->m_pblk) ||
  3582					ret == -ENOSPC) {
  3583				ext4_warning_inode(inode,
  3584					"Non-contiguous allocation detected: expected %llu, got %llu, "
  3585					"or ext4_map_blocks() returned out of space ret: %d",
  3586					next_pblk, map->m_pblk, ret);
  3587				ret = -EFSCORRUPTED;
  3588				goto out_err;
  3589			}
  3590			next_pblk = map->m_pblk + map->m_len;
  3591			check_next_pblk = true;
  3592	
  3593			mapped_len += map->m_len;
  3594			map->m_lblk += map->m_len;
  3595			map->m_len = m_len - mapped_len;
  3596		} while (mapped_len < m_len);
  3597	
  3598		/*
  3599		 * We might have done some work in above loop, so we need to query the
  3600		 * start of the physical extent, based on the origin m_lblk and m_len.
  3601		 * Let's also ensure we were able to allocate the required range for
  3602		 * mixed mapping case.
  3603		 */
  3604		map->m_lblk = m_lblk;
  3605		map->m_len = m_len;
  3606		map->m_flags = 0;
  3607	
  3608		ret = ext4_map_blocks(handle, inode, map,
  3609				      EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF);
  3610		if (ret != m_len) {
  3611			ext4_warning_inode(inode,
  3612				"allocation failed for atomic write request m_lblk:%u, m_len:%u, ret:%d\n",
  3613				m_lblk, m_len, ret);
  3614			ret = -EINVAL;
  3615		}
  3616		return ret;
  3617	
  3618	out_err:
  3619		/* reset map before returning an error */
  3620		map->m_lblk = m_lblk;
  3621		map->m_len = m_len;
  3622		map->m_flags = 0;
  3623		return ret;
  3624	}
  3625	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] fs: ext4: fix uninitialized symbols
  2025-10-11  6:38   ` [PATCH v2] " Ranganath V N
@ 2025-10-12 19:07     ` Theodore Ts'o
  2025-11-06 15:45     ` Theodore Ts'o
  1 sibling, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2025-10-12 19:07 UTC (permalink / raw)
  To: Ranganath V N
  Cc: lkp, adilger.kernel, david.hunter.linux, khalid, linux-ext4,
	linux-kernel-mentees, linux-kernel, oe-kbuild-all, skhan

On Sat, Oct 11, 2025 at 12:08:29PM +0530, Ranganath V N wrote:
> Fix the issue detected by the smatch tool.
> 
> fs/ext4/inode.c:3583 ext4_map_blocks_atomic_write_slow() error: uninitialized symbol 'next_pblk'.

This one is valid, and I agree with your proposed changed.  (Although
the worst that will happen is that in case of an ENOSPC error comined
with a corrpted file system the warning message may print an
uninitialized value.  So not a big eal, but we might as well fix it.)

> fs/ext4/namei.c:1776 ext4_lookup() error: uninitialized symbol 'de'.

This is a false positive for smatch.  There isn't actualy a prolem
here, because all of these funtions are calling ext4_find_entry() or
ext4_lookup_entry(), and the callers will not try to dereference the
pointer passed into *res_dir ('de') if the function has either
returned NULL or an ERR_PTR(), and that's in fact correct.

I don't especially mind the fix (but I do wish smatch could be
smarter).  Out of curiosity, if we move the *res_dir = NULL from
__ext4_find_entry() and move it so it's unconditionally set in
ext4_find_entry() and ext4_lookup_entry(), is that sufficient to make
smatch stop complaining?

					- Ted

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] fs: ext4: fix uninitialized symbols
  2025-10-11  6:38   ` [PATCH v2] " Ranganath V N
  2025-10-12 19:07     ` Theodore Ts'o
@ 2025-11-06 15:45     ` Theodore Ts'o
  1 sibling, 0 replies; 7+ messages in thread
From: Theodore Ts'o @ 2025-11-06 15:45 UTC (permalink / raw)
  To: lkp, Ranganath V N
  Cc: Theodore Ts'o, adilger.kernel, david.hunter.linux, khalid,
	linux-ext4, linux-kernel-mentees, linux-kernel, oe-kbuild-all,
	skhan


On Sat, 11 Oct 2025 12:08:29 +0530, Ranganath V N wrote:
> Fix the issue detected by the smatch tool.
> 
> fs/ext4/inode.c:3583 ext4_map_blocks_atomic_write_slow() error: uninitialized symbol 'next_pblk'.
> fs/ext4/namei.c:1776 ext4_lookup() error: uninitialized symbol 'de'.
> fs/ext4/namei.c:1829 ext4_get_parent() error: uninitialized symbol 'de'.
> fs/ext4/namei.c:3162 ext4_rmdir() error: uninitialized symbol 'de'.
> fs/ext4/namei.c:3242 __ext4_unlink() error: uninitialized symbol 'de'.
> fs/ext4/namei.c:3697 ext4_find_delete_entry() error: uninitialized symbol 'de'.
> 
> [...]

Applied, thanks!

[1/1] fs: ext4: fix uninitialized symbols
      commit: 6640d552185f7c11235c64a832004db9af119b2d

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-11-06 15:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 17:16 [PATCH] fs: ext4: fix uninitialized symbols Ranganath V N
2025-10-10 18:31 ` kernel test robot
2025-10-10 18:41 ` kernel test robot
2025-10-11  6:38   ` [PATCH v2] " Ranganath V N
2025-10-12 19:07     ` Theodore Ts'o
2025-11-06 15:45     ` Theodore Ts'o
2025-10-11  7:48 ` [PATCH] " kernel test robot

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).