public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@ns.caldera.de>
To: Joachim Weller <JoachimWeller@web.de>
Cc: Joachim Weller <joachim_weller@hsgmed.com>,
	axboe@suse.de, linux-kernel@vger.kernel.org
Subject: Re: BUG: cat /proc/partitions endless loop
Date: Fri, 28 Sep 2001 17:00:04 +0200	[thread overview]
Message-ID: <20010928170004.A14892@caldera.de> (raw)
In-Reply-To: <200109281448.f8SEmvh08284@mailgate5.cinetic.de>
In-Reply-To: <200109281448.f8SEmvh08284@mailgate5.cinetic.de>; from JoachimWeller@web.de on Fri, Sep 28, 2001 at 04:48:57PM +0200

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.

  reply	other threads:[~2001-09-28 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-28 14:48 Re: BUG: cat /proc/partitions endless loop Joachim Weller
2001-09-28 15:00 ` Christoph Hellwig [this message]
2001-09-28 15:22   ` Joachim Weller
  -- strict thread matches above, loose matches on Subject: below --
2001-09-28 13:15 Joachim Weller
2001-09-28 13:39 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010928170004.A14892@caldera.de \
    --to=hch@ns.caldera.de \
    --cc=JoachimWeller@web.de \
    --cc=axboe@suse.de \
    --cc=joachim_weller@hsgmed.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox