Skip to contentSkip to conversation

fs: ubifs: remove dead code

PATCH In review Peter Collingbourne 2 participants 4 messages May 12 – May 18 UBI file system (UBIFS)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: ubifs: remove dead code

This code is dead because it appears after an infinite loop; remove it.

Fixes 4c4477c77008 ("fs: ubifs: fix bugs involving symlinks in ubifs_findfile")
---
 fs/ubifs/ubifs.c | 3 ---
 1 file changed, 3 deletions(-)
fs/ubifs/ubifs.c +0 -3
index aafbd01a028..3f2e2037745 100644
@@ -608,9 +608,6 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
 		root_inum = inum;
 		name = next;
 	}
-
-	kfree(buf);
-	return 0;
 }
 
 int ubifs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw

Hello Peter,

Quoted 3 lines · Peter Collingbourne

This code is dead because it appears after an infinite loop; remove it.

Fixes 4c4477c77008 ("fs: ubifs: fix bugs involving symlinks in ubifs_findfile")

Wrong commit ID? I find in current HEAD:
"""
commit d5888d509cc43942ec98d993f2d129f5c8ddc432

Author: Peter Collingbourne <[email protected]>
Date:   Tue May 5 03:38:16 2026 -0700

fs: ubifs: fix bugs involving symlinks in ubifs_findfile
"""

Quoted 10 lines
---
  fs/ubifs/ubifs.c | 3 ---
  1 file changed, 3 deletions(-)
fs/ubifs/ubifs.c +0 -0
index aafbd01a028..3f2e2037745 100644

fs/ubifs/ubifs.c static unsigned long ubifs_findfile(struct super_block *sb, char *filename) · line 613

Quoted 6 lines
fs/ubifs/ubifs.c +0 -3
@@ -608,9 +608,6 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
  		root_inum = inum;
  		name = next;
  	}
-
-	kfree(buf);
-	return 0;

May we need to stay with "return 0;" at the end of the function, as some source code checking tool will claim if there is none?

Beside of the nitpick:

If you find time to send a v2 with updated commit ID I would be happy, else I can fix it when picking up the patch, if okay for you.

Thanks!

bye,
Heiko

Signature · 5 lines
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: [email protected]
Geschäftsführer : Stefano Babic
#2 lore raw

Hi Heiko,

Quoted 8 lines · Heiko Schocher

Hello Peter,

Quoted 3 lines · Peter Collingbourne

This code is dead because it appears after an infinite loop; remove it.

Fixes 4c4477c77008 ("fs: ubifs: fix bugs involving symlinks in ubifs_findfile")
Quoted 8 lines

Wrong commit ID? I find in current HEAD:
"""
commit d5888d509cc43942ec98d993f2d129f5c8ddc432

Author: Peter Collingbourne <[email protected]>
Date:   Tue May 5 03:38:16 2026 -0700

fs: ubifs: fix bugs involving symlinks in ubifs_findfile
"""

Yeah, I see the same. Looks like I accidentally used my original commit ID instead of the one that was pushed.

Quoted 5 lines
Quoted 5 lines
---
  fs/ubifs/ubifs.c | 3 ---
  1 file changed, 3 deletions(-)
Quoted 14 lines

fs/ubifs/ubifs.c static unsigned long ubifs_findfile(struct super_block *sb, char *filename) · line 613

Quoted 11 lines
fs/ubifs/ubifs.c +0 -3
index aafbd01a028..3f2e2037745 100644
@@ -608,9 +608,6 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
              root_inum = inum;
              name = next;
      }
-
-     kfree(buf);
-     return 0;

May we need to stay with "return 0;" at the end of the function, as some source code checking tool will claim if there is none?

I'd probably remove it unless some tool complains. If there's code at the end it can mislead readers into thinking it's reachable, which is how I ended up adding the kfree() there in the first place.

Quoted 6 lines

Beside of the nitpick:

If you find time to send a v2 with updated commit ID I would be happy, else I can fix it when picking up the patch, if okay for you.

Feel free to fix it up, thanks.

Peter

#3 lore raw

Hello Peter,

Quoted 17 lines · Peter Collingbourne

Hi Heiko,

Quoted 14 lines · Heiko Schocher

Hello Peter,

Quoted 3 lines · Peter Collingbourne

This code is dead because it appears after an infinite loop; remove it.

Fixes 4c4477c77008 ("fs: ubifs: fix bugs involving symlinks in ubifs_findfile")

Wrong commit ID? I find in current HEAD:
"""
commit d5888d509cc43942ec98d993f2d129f5c8ddc432

Author: Peter Collingbourne <[email protected]>
Date:   Tue May 5 03:38:16 2026 -0700
Quoted 10 lines
Quoted 2 lines

fs: ubifs: fix bugs involving symlinks in ubifs_findfile
"""

Yeah, I see the same. Looks like I accidentally used my original commit ID instead of the one that was pushed.

Quoted 4 lines
Quoted 4 lines
---
   fs/ubifs/ubifs.c | 3 ---
   1 file changed, 3 deletions(-)

Applied to u-boot-ubi.git

Thanks!

bye,
Heiko

Quoted 31 lines
Quoted 15 lines

fs/ubifs/ubifs.c static unsigned long ubifs_findfile(struct super_block *sb, char *filename) · line 613

Quoted 12 lines
fs/ubifs/ubifs.c +0 -3
index aafbd01a028..3f2e2037745 100644
@@ -608,9 +608,6 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
               root_inum = inum;
               name = next;
       }
-
-     kfree(buf);
-     return 0;

May we need to stay with "return 0;" at the end of the function, as some source code checking tool will claim if there is none?

I'd probably remove it unless some tool complains. If there's code at the end it can mislead readers into thinking it's reachable, which is how I ended up adding the kfree() there in the first place.

Quoted 6 lines

Beside of the nitpick:

If you find time to send a v2 with updated commit ID I would be happy, else I can fix it when picking up the patch, if okay for you.

Feel free to fix it up, thanks.

Peter

Signature · 5 lines
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: [email protected]
Geschäftsführer : Stefano Babic