mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: Re: BUG: cat /proc/partitions endless loop
@ 2001-09-28 14:48 Joachim Weller
  2001-09-28 15:00 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Joachim Weller @ 2001-09-28 14:48 UTC (permalink / raw)
  To: ChristophHellwig, Joachim Weller; +Cc: axboe, JoachimWeller, linux-kernel

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. 




>     if (gp->part[n].nr_sects == 0)
>      continue;
> 
>  


_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de



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

end of thread, other threads:[~2001-09-28 15:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-28 14:48 Re: BUG: cat /proc/partitions endless loop Joachim Weller
2001-09-28 15:00 ` Christoph Hellwig
2001-09-28 15:22   ` Joachim Weller

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®