* [PATCH] fix sun partition overflow over 1T
@ 2006-08-04 16:22 Eric Sandeen
2006-08-04 16:56 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2006-08-04 16:22 UTC (permalink / raw)
To: linux-kernel
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);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] fix sun partition overflow over 1T
2006-08-04 16:22 [PATCH] fix sun partition overflow over 1T Eric Sandeen
@ 2006-08-04 16:56 ` Alan Cox
2006-08-04 23:35 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2006-08-04 16:56 UTC (permalink / raw)
To: Eric Sandeen; +Cc: linux-kernel
Ar Gwe, 2006-08-04 am 11:22 -0500, ysgrifennodd Eric Sandeen:
> 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.
>
> Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Acked-by: Alan Cox <alan@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fix sun partition overflow over 1T
2006-08-04 16:56 ` Alan Cox
@ 2006-08-04 23:35 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2006-08-04 23:35 UTC (permalink / raw)
To: alan; +Cc: esandeen, linux-kernel
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date: Fri, 04 Aug 2006 17:56:30 +0100
> Ar Gwe, 2006-08-04 am 11:22 -0500, ysgrifennodd Eric Sandeen:
> > 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.
> >
>
> > Signed-off-by: Eric Sandeen <esandeen@redhat.com>
>
> Acked-by: Alan Cox <alan@redhat.com>
Applied, thanks a lot.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-08-04 23:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-04 16:22 [PATCH] fix sun partition overflow over 1T Eric Sandeen
2006-08-04 16:56 ` Alan Cox
2006-08-04 23:35 ` David Miller
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.