public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.5] [TRIVIAL] Get rid of magic numbers in drivers/block/genhd.c
@ 2003-05-03 22:04 René Scharfe
  2003-05-04  5:55 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: René Scharfe @ 2003-05-03 22:04 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel, trivial

Hi Christoph,

a few days ago you cleaned up disk_name() in fs/partitions/check.c. It
is now guaranteed to write no more than BDEVNAME_SIZE into the provided
buffer.

There are two buffers in drivers/block/genhd.c, that are used solely for
calling disk_name(), and have a size of 64. The patch below replaces
these magic numbers with BDEVNAME_SIZE.

Additionally it corrects the comment at the top of disk_name(): The md
driver does not call that function, the genhd driver does.

René



diff -ur l-x/drivers/block/genhd.c l-y/drivers/block/genhd.c
--- l-x/drivers/block/genhd.c	2003-05-03 21:37:47.000000000 +0200
+++ l-y/drivers/block/genhd.c	2003-05-03 23:58:35.000000000 +0200
@@ -350,7 +350,7 @@
 {
 	struct gendisk *sgp = v;
 	int n;
-	char buf[64];
+	char buf[BDEVNAME_SIZE];
 
 	if (&sgp->kobj.entry == block_subsys.kset.list.next)
 		seq_puts(part, "major minor  #blocks  name\n\n");
@@ -583,7 +583,7 @@
 static int diskstats_show(struct seq_file *s, void *v)
 {
 	struct gendisk *gp = v;
-	char buf[64];
+	char buf[BDEVNAME_SIZE];
 	int n = 0;
 
 	/*
diff -ur l-x/fs/partitions/check.c l-y/fs/partitions/check.c
--- l-x/fs/partitions/check.c	2003-05-03 21:37:59.000000000 +0200
+++ l-y/fs/partitions/check.c	2003-05-03 23:58:58.000000000 +0200
@@ -88,7 +88,7 @@
 };
  
 /*
- * disk_name() is used by partition check code and the md driver.
+ * disk_name() is used by partition check code and the genhd driver.
  * It formats the devicename of the indicated disk into
  * the supplied buffer (of size at least 32), and returns
  * a pointer to that same buffer (for convenience).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.5] [TRIVIAL] Get rid of magic numbers in drivers/block/genhd.c
  2003-05-03 22:04 [PATCH 2.5] [TRIVIAL] Get rid of magic numbers in drivers/block/genhd.c René Scharfe
@ 2003-05-04  5:55 ` Christoph Hellwig
  2003-05-05  4:42   ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2003-05-04  5:55 UTC (permalink / raw)
  To: René Scharfe; +Cc: linux-kernel, trivial

On Sun, May 04, 2003 at 12:04:25AM +0200, René Scharfe wrote:
> Hi Christoph,
> 
> a few days ago you cleaned up disk_name() in fs/partitions/check.c. It
> is now guaranteed to write no more than BDEVNAME_SIZE into the provided
> buffer.
> 
> There are two buffers in drivers/block/genhd.c, that are used solely for
> calling disk_name(), and have a size of 64. The patch below replaces
> these magic numbers with BDEVNAME_SIZE.
> 
> Additionally it corrects the comment at the top of disk_name(): The md
> driver does not call that function, the genhd driver does.

Looks fine to me.

Rusty, is the trivial patch bot still active?  I haven't seen Marcelo
or Linus merging trivial patches for ages (or maybe I've missed
something?)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2.5] [TRIVIAL] Get rid of magic numbers in drivers/block/genhd.c
  2003-05-04  5:55 ` Christoph Hellwig
@ 2003-05-05  4:42   ` Rusty Russell
  0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2003-05-05  4:42 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

In message <20030504075502.A6915@lst.de> you write:
> Rusty, is the trivial patch bot still active?  I haven't seen Marcelo
> or Linus merging trivial patches for ages (or maybe I've missed
> something?)

Yes, still active.  Their scripts used to take the last From:, so I
put the original author in a fake From line in the body.  Someone
"fixed" the scripts, so now they seem to come from me.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-05-05  4:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-03 22:04 [PATCH 2.5] [TRIVIAL] Get rid of magic numbers in drivers/block/genhd.c René Scharfe
2003-05-04  5:55 ` Christoph Hellwig
2003-05-05  4:42   ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox