hfsplus: rework processing of return value of bio_alloc() in hfsplus_submit_bio()
Subsystems (2)
Vyacheslav Dubeyko
maintainerPATCH 1/1 hfsplus: rework processing of return value of bio_alloc() in hfsplus_submit_bio()
Hi,
This patch adds logic of checking return value of bio_alloc() in hfsplus_submit_bio(). In the case of NULL the hfsplus_submit_bio() returns -EIO.
With the best regards,
Vyacheslav Dubeyko.
--
From: Vyacheslav Dubeyko <[email protected]>
Subject: [PATCH] hfsplus: rework processing of return value of bio_alloc() in hfsplus_submit_bio()
This patch adds logic of checking return value of bio_alloc() in hfsplus_submit_bio(). In the case of NULL the hfsplus_submit_bio() returns -EIO.
--- fs/hfsplus/wrapper.c | 3 +++ 1 file changed, 3 insertions(+)
fs/hfsplus/wrapper.c +3 -0
@@ -71,6 +71,9 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, sector &= ~((io_size >>HFSPLUS_SECTOR_SHIFT ) -1 ); bio =bio_alloc (GFP_NOIO ,1 ); +if (!bio) +return -EIO ; + bio->bi_sector = sector; bio->bi_bdev = sb->s_bdev; bio->bi_end_io = hfsplus_end_io_sync;
Signature · 1 line
1.7.9.5
Quoted 3 lines · Vyacheslav Dubeyko
Hi,
This patch adds logic of checking return value of
bio_alloc()inhfsplus_submit_bio(). In the case of NULL thehfsplus_submit_bio()returns-EIO.
bio_alloc does a mempool allocation and thus will never return NULL.
Vyacheslav Dubeyko
maintainerQuoted 7 lines · Christoph Hellwig
Quoted 3 lines · Vyacheslav Dubeyko
Hi,
This patch adds logic of checking return value of
bio_alloc()inhfsplus_submit_bio(). In the case of NULL thehfsplus_submit_bio()returns-EIO.
bio_allocdoes a mempool allocation and thus will never return NULL.
I don't insist on the patch. But if the function has such description:
* RETURNS:
* Pointer to new bio on success, NULL on failure.
I prefer to check on NULL anyway. :-)
With the best regards,
Vyacheslav Dubeyko.
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Vyacheslav Dubeyko
I don't insist on the patch. But if the function has such description:
* RETURNS:
* Pointer to new bio on success, NULL on failure.I prefer to check on NULL anyway. :-)
Check the sentence a couple lines above in the same comment:
* When @bs is not NULL, if %__GFP_WAIT is set then bio_alloc will always be
* able to allocate a bio. This is due to the mempool guarantees.
Vyacheslav Dubeyko
maintainerQuoted 6 lines · Christoph Hellwig
Quoted 5 lines · Vyacheslav Dubeyko
I don't insist on the patch. But if the function has such description:
* RETURNS:
* Pointer to new bio on success, NULL on failure.
Quoted 8 lines
Quoted 1 line
I prefer to check on NULL anyway. :-)
Check the sentence a couple lines above in the same comment:
* When @bs is not NULL, if %__GFP_WAIT is set then
bio_allocwill always be
* able to allocate a bio. This is due to the mempool guarantees.
Ok. Agree. Thank you. :-)
With the best regards,
Vyacheslav Dubeyko.