mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ph. Marek" <philipp.marek@bmlv.gv.at>
To: Andries.Brouwer@cwi.nl
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs/partitions/msdos.c Guard against negative sizes
Date: Mon, 27 Jan 2003 16:38:47 +0100	[thread overview]
Message-ID: <200301271638.47142.philipp.marek@bmlv.gv.at> (raw)
In-Reply-To: <UTC200301271203.h0RC3Sb19647.aeb@smtp.cwi.nl>

> >             u32 size = NR_SECTS(p)*sector_size;
> > -           if (!size)
> > +           if (size <= 0)
>
> But an unsigned variable cannot be negative, so what you write
> is the same as what was there already.
>
> In other words, your "negative" sizes are just very large positive.
>
> The test should be whether the partition extends beyond the end
> of the disk, but sometimes that is allowed, even necessary, so
> there could be a warning only.
Sorry, didn't pay enough attention.
On second look: it's an u32.
But that brings the next question up: what about overflow? u32 means a max of 
4GB.
	u32 start = START_SECT(p)*sector_size;
	u32 size = NR_SECTS(p)*sector_size;
And this looks as if it was calculated in bytes - but I'm sure that 4GB is not 
the max size! Where am I wrong??

And btw, when can a partition that extends beyond the end be "allowed or even 
necessary"?


Thanks for your answer!


Regards,

Phil



       reply	other threads:[~2003-01-27 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <UTC200301271203.h0RC3Sb19647.aeb@smtp.cwi.nl>
2003-01-27 15:38 ` Ph. Marek [this message]
2003-01-27 16:48 Andries.Brouwer
  -- strict thread matches above, loose matches on Subject: below --
2003-01-27 11:30 Ph. Marek
2003-01-27 14:03 ` Andries Brouwer

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=200301271638.47142.philipp.marek@bmlv.gv.at \
    --to=philipp.marek@bmlv.gv.at \
    --cc=Andries.Brouwer@cwi.nl \
    --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

all inboxes | Powered by JetHome®