From: Eric Sandeen <esandeen@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] fix sun partition overflow over 1T
Date: Fri, 04 Aug 2006 11:22:24 -0500 [thread overview]
Message-ID: <44D37440.9080100@redhat.com> (raw)
Although sun partition labels aren't supposed to support > 1T, apparently
linux partition editors will allow up to 2T. This can cause problems
in the kernel when these larger partitions are read, due to a signed
int container.
num_sectors in the sun_disklabel struct is marked as __u32 in 2.4, and
as __be32 in 2.6. However, this is assigned to a signed int in
sun_partition():
int num_sectors;
st_sector = be32_to_cpu(p->start_cylinder) * spc;
num_sectors = be32_to_cpu(p->num_sectors);
Changing num_sectors to an unsigned int avoids this problem.
Thanks,
-Eric
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Index: linux-2.6.17/fs/partitions/sun.c
===================================================================
--- linux-2.6.17.orig/fs/partitions/sun.c
+++ linux-2.6.17/fs/partitions/sun.c
@@ -74,7 +74,7 @@ int sun_partition(struct parsed_partitio
spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);
for (i = 0; i < 8; i++, p++) {
unsigned long st_sector;
- int num_sectors;
+ unsigned int num_sectors;
st_sector = be32_to_cpu(p->start_cylinder) * spc;
num_sectors = be32_to_cpu(p->num_sectors);
next reply other threads:[~2006-08-04 16:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-04 16:22 Eric Sandeen [this message]
2006-08-04 16:56 ` Alan Cox
2006-08-04 23:35 ` David Miller
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=44D37440.9080100@redhat.com \
--to=esandeen@redhat.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
all inboxes | Powered by JetHome®