From: Axel Lin <axel.lin@ingics.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Ming Lei <ming.lei@canonical.com>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] block: partition-generic: Catch alloc_part_info failure
Date: Tue, 23 Jun 2015 08:41:02 +0800 [thread overview]
Message-ID: <1435020062.6479.0.camel@ingics.com> (raw)
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/
reply other threads:[~2015-06-23 0:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435020062.6479.0.camel@ingics.com \
--to=axel.lin@ingics.com \
--cc=axboe@kernel.dk \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@canonical.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox