Skip to content

Commit a21f3c2

Browse files
Julia Lawalltorvalds
authored andcommitted
fs/romfs: correct error-handling code
romfs_iget returns an ERR_PTR value in an error case instead of NULL. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @match exists@ expression x, E; statement S1, S2; @@ x = romfs_iget(...) ... when != x = E ( * if (x == NULL || ...) S1 else S2 | * if (x == NULL && ...) S1 else S2 ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9e5f113 commit a21f3c2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/romfs/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ static int romfs_fill_super(struct super_block *sb, void *data, int silent)
528528
pos = (ROMFH_SIZE + len + 1 + ROMFH_PAD) & ROMFH_MASK;
529529

530530
root = romfs_iget(sb, pos);
531-
if (!root)
531+
if (IS_ERR(root))
532532
goto error;
533533

534534
sb->s_root = d_alloc_root(root);

0 commit comments

Comments
 (0)