Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Btrfs: check return value of bio_alloc() properly

bio_alloc() has the possibility of returning NULL.
So, it is necessary to check the return value.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>

authored by

Tsutomu Itoh and committed by
Chris Mason
e627ee7b c6664b42

+10
+2
fs/btrfs/compression.c
··· 405 405 bio_put(bio); 406 406 407 407 bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS); 408 + BUG_ON(!bio); 408 409 bio->bi_private = cb; 409 410 bio->bi_end_io = end_compressed_bio_write; 410 411 bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); ··· 688 687 689 688 comp_bio = compressed_bio_alloc(bdev, cur_disk_byte, 690 689 GFP_NOFS); 690 + BUG_ON(!comp_bio); 691 691 comp_bio->bi_private = cb; 692 692 comp_bio->bi_end_io = end_compressed_bio_read; 693 693
+4
fs/btrfs/extent_io.c
··· 2180 2180 } 2181 2181 2182 2182 bio = bio_alloc(GFP_NOFS, 1); 2183 + if (!bio) { 2184 + free_io_failure(inode, failrec, 0); 2185 + return -EIO; 2186 + } 2183 2187 bio->bi_private = state; 2184 2188 bio->bi_end_io = failed_bio->bi_end_io; 2185 2189 bio->bi_sector = failrec->logical >> 9;
+4
fs/btrfs/scrub.c
··· 1044 1044 1045 1045 BUG_ON(!page->page); 1046 1046 bio = bio_alloc(GFP_NOFS, 1); 1047 + if (!bio) 1048 + return -EIO; 1047 1049 bio->bi_bdev = page->bdev; 1048 1050 bio->bi_sector = page->physical >> 9; 1049 1051 bio->bi_end_io = scrub_complete_bio_end_io; ··· 1174 1172 DECLARE_COMPLETION_ONSTACK(complete); 1175 1173 1176 1174 bio = bio_alloc(GFP_NOFS, 1); 1175 + if (!bio) 1176 + return -EIO; 1177 1177 bio->bi_bdev = page_bad->bdev; 1178 1178 bio->bi_sector = page_bad->physical >> 9; 1179 1179 bio->bi_end_io = scrub_complete_bio_end_io;