mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 2.4.23 Failure to reload partitions past 1TB
@ 2003-09-18 19:47 Curtis Regentin
  0 siblings, 0 replies; only message in thread
From: Curtis Regentin @ 2003-09-18 19:47 UTC (permalink / raw)
  To: linux-kernel

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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-09-18 19:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-18 19:47 [PATCH] 2.4.23 Failure to reload partitions past 1TB Curtis Regentin

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®