* [PATCH] block: partition-generic: Catch alloc_part_info failure
@ 2015-06-23 0:41 Axel Lin
0 siblings, 0 replies; only message in thread
From: Axel Lin @ 2015-06-23 0:41 UTC (permalink / raw)
To: Jens Axboe; +Cc: Ming Lei, Yasuaki Ishimatsu, linux-kernel
Make add_partition() return proper ERR_PTR if alloc_part_info() fails.
This ensures the caller of add_partition() can catch the error by IS_ERROR
macro.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
block/partition-generic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 0d9e5f9..94de205 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -309,8 +309,10 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
if (info) {
struct partition_meta_info *pinfo = alloc_part_info(disk);
- if (!pinfo)
+ if (!pinfo) {
+ err = -ENOMEM;
goto out_free_stats;
+ }
memcpy(pinfo, info, sizeof(*info));
p->info = pinfo;
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-23 0:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 0:41 [PATCH] block: partition-generic: Catch alloc_part_info failure Axel Lin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.