Skip to content

Commit

Permalink
udf: Fix inode_getblk() return value
Browse files Browse the repository at this point in the history
Smatch noticed that inode_getblk() can return 1 on successful mapping of
a block instead of expected 0 after commit b405c1e ("udf: refactor
udf_next_aext() to handle error"). This could confuse some of the
callers and lead to strange failures (although the one reported by
Smatch in udf_mkdir() is impossible to trigger in practice). Fix the
return value of inode_getblk().

Link: https://lore.kernel.org/all/cb514af7-bbe0-435b-934f-dd1d7a16d2cd@stanley.mountain
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Fixes: b405c1e ("udf: refactor udf_next_aext() to handle error")
CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Mar 13, 2025
1 parent a7624cc commit 6afdc60
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ static int inode_getblk(struct inode *inode, struct udf_map_rq *map)
}
map->oflags = UDF_BLK_MAPPED;
map->pblk = udf_get_lb_pblock(inode->i_sb, &eloc, offset);
ret = 0;
goto out_free;
}

Expand Down

0 comments on commit 6afdc60

Please sign in to comment.