lkml.org 
[lkml]   [2001]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: BUG: cat /proc/partitions endless loop
On Fri, Sep 28, 2001 at 04:48:57PM +0200, Joachim Weller wrote:
> Christoph Hellwig <hch@ns.caldera.de> schrieb am 28.09.01:
> > 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:
> [...]
>
> > + for (gp = gendisk_head; gp != gendisk_head; gp = gp->next) {
>
> This will break your for loop immedeately, because the loop criteria
> is already violated by the initialization !
>
> But I tried another solution:
> for (gp = gendisk_head; gp && (gp->next != gendisk_head); gp = gp->next) {
>
> with no success - the cat /proc/partition only printed the heading line.
> This proofed to me, that the pointered list is created the wrong way,
> in other words, gendisk_head->next is a pointer to itself.
> It looks to me, that the "next" field in
> /*static*/ struct gendisk *gendisk_head;
> is not initialized (by the compiler ?) correctly to NULL.

That's odd, could you try initilazing gendisk_head to NULL explicitly and try
my proposed fix? The gendisk list handling starts to smell _really_ funny.

Christoph

--
Of course it doesn't work. We've performed a software upgrade.
-
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    [W:0.037 / U:5.984 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site