fs/ntfs3: remove unnecessary NULL check
Subsystems (3)
PATCH 1/1 fs/ntfs3: remove unnecessary NULL check
This code triggers a Smatch warning:
fs/ntfs3/fsntfs.c:1606 ntfs_bio_fill_1()
warn: variable dereferenced before check 'bio' (see line 1591)
The "bio" pointer cannot be NULL so there is no need to check. Originally there was more extensive NULL checking but it was removed because bio_alloc() will never fail if it is allowed to sleep.
Remove this check as well.
---
This patch applies on top of Christoph's bio allocation series and needs through the block tree, I think. I included a Fixes tag even though it's not really a bugfix...
fs/ntfs3/fsntfs.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/ntfs3/fsntfs.c +4 -5
@@ -1603,11 +1603,10 @@ int ntfs_bio_fill_1(struct ntfs_sb_info *sbi, const struct runs_tree *run) } }while (run_get_entry (run, ++run_idx,NULL , &lcn, &clen)); -if (bio) { -if (!err) - err =submit_bio_wait (bio); -bio_put (bio); - } +if (!err) + err =submit_bio_wait (bio); +bio_put (bio); +blk_finish_plug (&plug); out:unlock_page (fill);
Signature · 1 line
2.20.1
Looks good:
Quoted 10 lines · Dan Carpenter
This code triggers a Smatch warning:
fs/ntfs3/fsntfs.c:1606ntfs_bio_fill_1()
warn: variable dereferenced before check 'bio' (see line 1591)The "bio" pointer cannot be NULL so there is no need to check. Originally there was more extensive NULL checking but it was removed because
bio_alloc()will never fail if it is allowed to sleep.[...]
Applied, thanks!
[1/1] fs/ntfs3: remove unnecessary NULL check
commit: 365ab499153cdb2007d54e7e62bcbf2c67f7ab8f
Best regards,
Signature · 1 line
Jens Axboe