diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-06-06 10:18:22 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-06-06 10:18:22 -0400 |
commit | a1d8d9a757cd46e044a3f6061c315eda14bf697e (patch) | |
tree | 1f8cda247a0f1e0f6eb8346da151e64b5d46e0ed /fs/ext4 | |
parent | 5dc23bdd5f846ef868e82f789dfd9b13093f9ba6 (diff) |
ext4: add check to io_submit_init_bio
The bio_alloc() function can return NULL if the memory allocation
fails. So we need to check for this.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/page-io.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index ce8c15a7eabc..48786cdb5e6c 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -372,6 +372,8 @@ static int io_submit_init_bio(struct ext4_io_submit *io, | |||
372 | struct bio *bio; | 372 | struct bio *bio; |
373 | 373 | ||
374 | bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES)); | 374 | bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES)); |
375 | if (!bio) | ||
376 | return -ENOMEM; | ||
375 | bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9); | 377 | bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9); |
376 | bio->bi_bdev = bh->b_bdev; | 378 | bio->bi_bdev = bh->b_bdev; |
377 | bio->bi_end_io = ext4_end_bio; | 379 | bio->bi_end_io = ext4_end_bio; |