Rickard Strandqvist
2014-May-27 20:23 UTC
[PATCH] fs: ocfs2: move_extents.c: Fix to remove null pointer checks that could never happen
Removal of null pointer checks that could never happen Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> --- fs/ocfs2/move_extents.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 599eb4c..9ba3a10 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c @@ -904,9 +904,6 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context) struct buffer_head *di_bh = NULL; struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); - if (!inode) - return -ENOENT; - if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) return -EROFS; -- 1.7.10.4
Andrew Morton
2014-May-29 21:03 UTC
[Ocfs2-devel] [PATCH] fs: ocfs2: move_extents.c: Fix to remove null pointer checks that could never happen
On Tue, 27 May 2014 22:23:51 +0200 Rickard Strandqvist <rickard_strandqvist at spectrumdigital.se> wrote:> Removal of null pointer checks that could never happenHow do you know it never happens?> --- a/fs/ocfs2/move_extents.c > +++ b/fs/ocfs2/move_extents.c > @@ -904,9 +904,6 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context) > struct buffer_head *di_bh = NULL; > struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); > > - if (!inode) > - return -ENOENT; > -If it's due to assuming that the previous statement would have oopsed then that is mistaken. Is is sometimes the case that gcc will move the evaluation of inode->i_sb to after the test, so this function can be passed NULL and it will not oops.