From: Borislav Petkov <bbpetkov@yahoo.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/partitions/check.c: add error handling for kobject_add
Date: Wed, 24 Oct 2007 11:32:53 +0200 [thread overview]
Message-ID: <20071024093253.GA6191@gollum.tnic> (raw)
In-Reply-To: <20071023233900.7e683516.akpm@linux-foundation.org>
On Tue, Oct 23, 2007 at 11:39:00PM -0700, Andrew Morton wrote:
> I get 100% rejects from this. Please redo against latest mainline.
Here you go, this one is against today's 24-rc1.
---
From: Borislav Petkov <bbpetkov@yahoo.de>
Add error handling to the kobject_add()-call and signal (the even highly
unlikely) error condition.
Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
--
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 722e12e..6ba66b4 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -371,11 +371,12 @@ void delete_partition(struct gendisk *disk, int part)
void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
{
struct hd_struct *p;
+ int err = -EINVAL;
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return;
-
+
p->start_sect = start;
p->nr_sects = len;
p->partno = part;
@@ -390,7 +391,13 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
p->kobj.parent = &disk->kobj;
p->kobj.ktype = &ktype_part;
kobject_init(&p->kobj);
- kobject_add(&p->kobj);
+
+ err = kobject_add(&p->kobj);
+ if (err) {
+ pr_err("%s: error adding %s to sysfs.\n", __FUNCTION__,
+ kobject_name(&p->kobj));
+ }
+
if (!disk->part_uevent_suppress)
kobject_uevent(&p->kobj, KOBJ_ADD);
sysfs_create_link(&p->kobj, &block_subsys.kobj, "subsystem");
--
Regards/Gruß,
Boris.
prev parent reply other threads:[~2007-10-24 9:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-22 5:22 Borislav Petkov
[not found] ` <20071023233900.7e683516.akpm@linux-foundation.org>
2007-10-24 9:32 ` Borislav Petkov [this message]
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=20071024093253.GA6191@gollum.tnic \
--to=bbpetkov@yahoo.de \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®