All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] fix an infinite loop with a corrupted pc partition table
Date: Tue, 28 Jul 2009 19:55:14 +0200	[thread overview]
Message-ID: <20090728175514.GE32726@thorin> (raw)
In-Reply-To: <d7ead6de0907251558ib6cce10x15111b9baac25a95@mail.gmail.com>

On Sun, Jul 26, 2009 at 12:58:59AM +0200, Vladimir 'phcoder' Serbinenko wrote:
> +      /* This is our loop-detection algorithm. It works the following way:
> +	 It saves last position which was a power of two. Then it compares the
> +	 saved value with a current one. This way it's guaranteed that the loop
> +	 will be broken by at most third walk.
> +       */
> +      if (lastaddr == p.offset)
> +	return grub_error (GRUB_ERR_BAD_PART_TABLE, "loop detected");
> +
> +      labeln++;
> +      if (labeln == (lastlabeln << 1))
> +	{
> +	  lastaddr = p.offset;
> +	  lastlabeln <<= 1;
> +	}

I would prefer something simpler, but if that's not possible, this is better
than hardcoding a number IMO.

Unless Pavel has any objection, I think it's ok.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



  parent reply	other threads:[~2009-07-28 21:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-24 16:58 [PATCH] fix an infinite loop with a corrupted pc partition table Felix Zielcke
2009-07-24 19:24 ` Felix Zielcke
2009-07-24 20:28   ` Pavel Roskin
2009-07-24 20:46     ` Vladimir 'phcoder' Serbinenko
2009-07-25 16:36   ` Robert Millan
2009-07-25 16:56     ` Vladimir 'phcoder' Serbinenko
2009-07-25 22:06       ` Pavel Roskin
2009-07-25 22:35         ` Vladimir 'phcoder' Serbinenko
2009-07-25 22:58           ` Vladimir 'phcoder' Serbinenko
2009-07-25 23:20             ` Vladimir 'phcoder' Serbinenko
2009-07-26  6:49               ` Felix Zielcke
2009-07-28 17:55             ` Robert Millan [this message]
2009-08-23 15:40               ` Vladimir 'phcoder' Serbinenko
2009-08-28 17:30                 ` Vladimir 'phcoder' Serbinenko
2009-09-11 21:50                 ` Pavel Roskin
2009-07-24 19:56 ` Pavel Roskin
2009-07-24 20:35   ` Vladimir 'phcoder' Serbinenko
2009-07-24 21:03     ` Pavel Roskin
2009-07-25 10:48       ` Vladimir 'phcoder' Serbinenko

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=20090728175514.GE32726@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.