* Re: [RFC, 2.6.26.2-rc1] fs/partition/check.c: fix return value warning
2008-08-02 20:02 [RFC, 2.6.26.2-rc1] fs/partition/check.c: fix return value warning Oliver Pinter
@ 2008-08-02 19:56 ` Linus Torvalds
2008-08-02 20:04 ` Willy Tarreau
0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2008-08-02 19:56 UTC (permalink / raw)
To: Oliver Pinter
Cc: Abdel Benamrouche, stable, jens.axboe, Andrew Morton, linux-kernel
On Sat, 2 Aug 2008, Oliver Pinter wrote:
>
> Subject: [PATCH] fs/partition/check.c: fix return value warning
>
> [ Upstream commit d805dda412346225a50af2d399d958a4bc676c38 ]
Why are these being submitted for stable kernels?
Oliver - stable kernels should _not_ get trivial fixes that don't actually
have any problems associated with them.
Every patch in a stable kernel has a downside. It had better have a big
upside too. These don't.
Please don't just send patches to the stable team because they "look
fine". They should be real bugs, with real consequences. And no, a
compiler warning is not a real consequence.
Linus
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC, 2.6.26.2-rc1] fs/partition/check.c: fix return value warning
@ 2008-08-02 20:02 Oliver Pinter
2008-08-02 19:56 ` Linus Torvalds
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Pinter @ 2008-08-02 20:02 UTC (permalink / raw)
To: Abdel Benamrouche, stable
Cc: jens.axboe, Andrew Morton, Linus Torvalds, Oliver Pinter, linux-kernel
>From d805dda412346225a50af2d399d958a4bc676c38 Mon Sep 17 00:00:00 2001
From: Abdel Benamrouche <draconux@gmail.com>
Date: Fri, 25 Jul 2008 01:48:25 -0700
Subject: [PATCH] fs/partition/check.c: fix return value warning
[ Upstream commit d805dda412346225a50af2d399d958a4bc676c38 ]
fs/partitions/check.c:381: warning: ignoring return value of ___device_add___,
declared with attribute warn_unused_result
[akpm@linux-foundation.org: multiple-return-statements-per-function are evil]
Signed-off-by: Abdel Benamrouche <draconux@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
CC: Oliver Pinter <oliver.pntr@gmail.com>
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index efef715..2e6413f 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -344,18 +344,18 @@ static ssize_t whole_disk_show(struct device *dev,
static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH,
whole_disk_show, NULL);
-void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
+int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
{
struct hd_struct *p;
int err;
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
- return;
+ return -ENOMEM;
if (!init_part_stats(p)) {
- kfree(p);
- return;
+ err = -ENOMEM;
+ goto out0;
}
p->start_sect = start;
p->nr_sects = len;
@@ -378,15 +378,31 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
/* delay uevent until 'holders' subdir is created */
p->dev.uevent_suppress = 1;
- device_add(&p->dev);
+ err = device_add(&p->dev);
+ if (err)
+ goto out1;
partition_sysfs_add_subdir(p);
p->dev.uevent_suppress = 0;
- if (flags & ADDPART_FLAG_WHOLEDISK)
+ if (flags & ADDPART_FLAG_WHOLEDISK) {
err = device_create_file(&p->dev, &dev_attr_whole_disk);
+ if (err)
+ goto out2;
+ }
/* suppress uevent if the disk supresses it */
if (!disk->dev.uevent_suppress)
kobject_uevent(&p->dev.kobj, KOBJ_ADD);
+
+ return 0;
+
+out2:
+ device_del(&p->dev);
+out1:
+ put_device(&p->dev);
+ free_part_stats(p);
+out0:
+ kfree(p);
+ return err;
}
/* Not exported, helper to add_disk(). */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e878741..118216f 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -541,7 +541,7 @@ extern dev_t blk_lookup_devt(const char *name, int part);
extern char *disk_name (struct gendisk *hd, int part, char *buf);
extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
-extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
+extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int);
extern void delete_partition(struct gendisk *, int);
extern void printk_all_partitions(void);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC, 2.6.26.2-rc1] fs/partition/check.c: fix return value warning
2008-08-02 19:56 ` Linus Torvalds
@ 2008-08-02 20:04 ` Willy Tarreau
2008-08-02 20:09 ` Oliver Pinter
0 siblings, 1 reply; 5+ messages in thread
From: Willy Tarreau @ 2008-08-02 20:04 UTC (permalink / raw)
To: Linus Torvalds
Cc: Oliver Pinter, Abdel Benamrouche, stable, jens.axboe,
Andrew Morton, linux-kernel
On Sat, Aug 02, 2008 at 12:56:10PM -0700, Linus Torvalds wrote:
> Please don't just send patches to the stable team because they "look
> fine". They should be real bugs, with real consequences. And no, a
> compiler warning is not a real consequence.
BTW, before Oliver does the mistake, I'd suggest never forwarding
network patches to stable either as Davem already maintains his
own -stable queue ;-)
Willy
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC, 2.6.26.2-rc1] fs/partition/check.c: fix return value warning
2008-08-02 20:04 ` Willy Tarreau
@ 2008-08-02 20:09 ` Oliver Pinter
2008-08-03 11:12 ` Stefan Richter
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Pinter @ 2008-08-02 20:09 UTC (permalink / raw)
To: Willy Tarreau
Cc: Linus Torvalds, Abdel Benamrouche, stable, jens.axboe,
Andrew Morton, linux-kernel
Willy, this good to know ...
and I think, this patch fixed a small leak:
+
+out2:
+ device_del(&p->dev);
+out1:
+ put_device(&p->dev);
+ free_part_stats(p);
+out0:
+ kfree(p);
+ return err;
On 8/2/08, Willy Tarreau <w@1wt.eu> wrote:
> On Sat, Aug 02, 2008 at 12:56:10PM -0700, Linus Torvalds wrote:
>> Please don't just send patches to the stable team because they "look
>> fine". They should be real bugs, with real consequences. And no, a
>> compiler warning is not a real consequence.
>
> BTW, before Oliver does the mistake, I'd suggest never forwarding
> network patches to stable either as Davem already maintains his
> own -stable queue ;-)
>
> Willy
>
>
--
Thanks,
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC, 2.6.26.2-rc1] fs/partition/check.c: fix return value warning
2008-08-02 20:09 ` Oliver Pinter
@ 2008-08-03 11:12 ` Stefan Richter
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Richter @ 2008-08-03 11:12 UTC (permalink / raw)
To: Oliver Pinter
Cc: Willy Tarreau, Linus Torvalds, Abdel Benamrouche, stable,
jens.axboe, Andrew Morton, linux-kernel
Oliver Pinter wrote:
> Willy, this good to know ...
>
> and I think, this patch fixed a small leak:
>
> +
> +out2:
> + device_del(&p->dev);
> +out1:
> + put_device(&p->dev);
> + free_part_stats(p);
> +out0:
> + kfree(p);
> + return err;
>
>
> On 8/2/08, Willy Tarreau <w@1wt.eu> wrote:
>> On Sat, Aug 02, 2008 at 12:56:10PM -0700, Linus Torvalds wrote:
>>> Please don't just send patches to the stable team because they "look
>>> fine". They should be real bugs, with real consequences. And no, a
>>> compiler warning is not a real consequence.
Oliver, check under which circumstances the leak happens, and which
problems the leak causes for the system.
Newly added failure handling paths, which by nature are insufficiently
runtime-tested, need to be well considered before they are taken over
into -stable even if the code looks OK. I.e. they need to address bugs
which are known to cause problems of certain severity in practice.
--
Stefan Richter
-=====-==--- =--- ---==
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-08-03 11:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-02 20:02 [RFC, 2.6.26.2-rc1] fs/partition/check.c: fix return value warning Oliver Pinter
2008-08-02 19:56 ` Linus Torvalds
2008-08-02 20:04 ` Willy Tarreau
2008-08-02 20:09 ` Oliver Pinter
2008-08-03 11:12 ` Stefan Richter
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®