lkml.org 
[lkml]   [2001]   [Sep]   [28]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateFri, 28 Sep 2001 15:39:01 +0200
FromChristoph Hellwig <>
SubjectRe: BUG: cat /proc/partitions endless loop
In article <200109281315.f8SDFpA01669@bmdipc2c.germany.agilent.com> you wrote:
>  I traced the problem down to drivers/block/genhd.c, 
> where the function get_partition_list() outer loop does not 
> terminate due to the last element in the structured list starting 
> with gendisk_head is not initialized to NULL, by whatever reason.
> My fix does not cure the pointered endless loop, but prevents
> from looping when stepping thru the pointered list.

I think the fix could be simpler.  What about:

--- ../master/linux-2.4.10/drivers/block/genhd.c	Sun Sep 23 21:20:52 2001
+++ linux-2.4.10/drivers/block/genhd.c	Fri Sep 28 15:34:14 2001
@@ -115,7 +115,7 @@
 
 	len = sprintf(page, "major minor  #blocks  name\n\n");
 	read_lock(&gendisk_lock);
-	for (gp = gendisk_head; gp; gp = gp->next) {
+	for (gp = gendisk_head; gp != gendisk_head; gp = gp->next) {
 		for (n = 0; n < (gp->nr_real << gp->minor_shift); n++) {
 			if (gp->part[n].nr_sects == 0)
 				continue;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:03    [from the cache]
©2003-2008