CHROMIUM: fs: bio: check bs null in error path

smatch error:
fs/bio.c:365 bio_alloc_bioset() error: we previously assumed 'bs' could be null (see line 329)
Added a check for if bs is null before freeing resources that may have been
assigned to bs.

BUG=chromium:237705
TEST=FEATURES=test emerge-$B chromeos-kernel-next

Change-Id: I1f1e30a1d095d5341584b5fec34e527c727c3f69
Signed-off-by: Paul Taysom <taysom@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/59069
Reviewed-by: Sonny Rao <sonnyrao@chromium.org>
This commit is contained in:
Paul Taysom
2013-06-18 09:08:01 -07:00
committed by Ben Zhang
parent 6d2022f2a5
commit 49ced58691

View File

@@ -490,7 +490,8 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
return bio;
err_free:
mempool_free(p, bs->bio_pool);
if (bs)
mempool_free(p, bs->bio_pool);
return NULL;
}
EXPORT_SYMBOL(bio_alloc_bioset);