From: WANG Cong <xiyou.wangcong@gmail.com>
To: steve@chygwyn.com, pavel@ucw.cz, Paul.Clements@steeleye.com,
akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Wang Ya-gang <lazy_linux@126.com>,
Chen Li-jun <cljun@xiyou.edu.cn>
Subject: [-mm Patch]nbd: check the return value of sysfs_create_file
Date: Sat, 28 Apr 2007 13:30:23 +0800 [thread overview]
Message-ID: <20070428053023.GA2578@localhost.localdomain> (raw)
Since 'sysfs_create_file' is declared with attribute warn_unused_result, we must always check its return value carefully.
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
---
--- linux-2.6.21-rc7-mm2/drivers/block/nbd.c.orig 2007-04-27 17:27:47.000000000 +0800
+++ linux-2.6.21-rc7-mm2/drivers/block/nbd.c 2007-04-27 17:47:32.000000000 +0800
@@ -373,7 +373,10 @@ static void nbd_do_it(struct nbd_device
BUG_ON(lo->magic != LO_MAGIC);
lo->pid = current->pid;
- sysfs_create_file(&lo->disk->kobj, &pid_attr.attr);
+ if (sysfs_create_file(&lo->disk->kobj, &pid_attr.attr)) {
+ printk(KERN_ERR "nbd: sysfs_create_file failed!");
+ return;
+ }
while ((req = nbd_read_stat(lo)) != NULL)
nbd_end_request(req);
next reply other threads:[~2007-04-28 5:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-28 5:30 WANG Cong [this message]
2007-05-04 6:14 ` [-mm Patch]nbd: check the return value of sysfs_create_file Andrew Morton
2007-05-04 7:39 ` WANG Cong
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=20070428053023.GA2578@localhost.localdomain \
--to=xiyou.wangcong@gmail.com \
--cc=Paul.Clements@steeleye.com \
--cc=akpm@linux-foundation.org \
--cc=cljun@xiyou.edu.cn \
--cc=lazy_linux@126.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=steve@chygwyn.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