lkml.org 
[lkml]   [2003]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 2.4.23 Failure to reload partitions past 1TB
parted fails when creating partitions > 1TB.

If anyone doesn't like my assumption of 32bit long,
feel free to fix it, or tell me the apropriate method.
Enough assumptions are made about that in this code
that I don't feel too bad, and no MAXULONG seems
defined in the kernel tree.

Please CC me on replies.

--- SNIP ---
--- linux-2.4.22.old/drivers/block/blkpg.c 2003-09-18
11:48:04.000000000 -0700
+++ linux-2.4.22/drivers/block/blkpg.c 2003-09-18
12:19:25.000000000 -0700
@@ -63,21 +63,20 @@
* or has the same number as an
existing one
* 0: all OK.
*/
+
int add_partition(kdev_t dev, struct blkpg_partition
*p) {
struct gendisk *g;
- long long ppstart, pplength;
- long pstart, plength;
+ unsigned long long pstart, plength;
int i, drive, first_minor, end_minor, minor;
+ unsigned long maxblock = 0xffffffffUL;

/* convert bytes to sectors, check for fit in a
hd_struct */
- ppstart = (p->start >> 9);
- pplength = (p->length >> 9);
- pstart = ppstart;
- plength = pplength;
- if (pstart != ppstart || plength != pplength
- || pstart < 0 || plength < 0)
+ pstart = (p->start >> 9);
+ plength = (p->length >> 9);
+ if (pstart > maxblock || plength > maxblock ||
(pstart+plength) > maxblock)
return -EINVAL;

+
/* find the drive major */
g = get_gendisk(dev);
if (!g)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.043 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site