public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.4.13pre3: loop uses wrong type for blk_size[]
@ 2001-10-17 18:40 Chip Salzenberg
  0 siblings, 0 replies; only message in thread
From: Chip Salzenberg @ 2001-10-17 18:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

In 2.4.13pre3, the loop device was changed to use an array of unsigned
long for its entry in blk_size[].  This is broken, because blk_size[]
is of type 'int * []'.  A patch is attached which fixes this problem
while still retaining the presumably intended behavior of working
properly with large devices.
-- 
Chip Salzenberg               - a.k.a. -              <chip@pobox.com>
 "We have no fuel on board, plus or minus 8 kilograms."  -- NEAR tech

[-- Attachment #2: pre3-loop-blksize-int-fix --]
[-- Type: text/plain, Size: 1358 bytes --]


Index: linux/drivers/block/loop.c
--- linux/drivers/block/loop.c.old	Tue Oct 16 23:28:20 2001
+++ linux/drivers/block/loop.c	Wed Oct 17 01:09:07 2001
@@ -78,5 +78,5 @@
 static int max_loop = 8;
 static struct loop_device *loop_dev;
-static unsigned long *loop_sizes;
+static int *loop_sizes;
 static int *loop_blksizes;
 static devfs_handle_t devfs_handle;      /*  For the directory */
@@ -152,5 +152,5 @@
 #define MAX_DISK_SIZE 1024*1024*1024
 
-static unsigned long compute_loop_size(struct loop_device *lo, struct dentry * lo_dentry, kdev_t lodev)
+static int compute_loop_size(struct loop_device *lo, struct dentry * lo_dentry, kdev_t lodev)
 {
 	if (S_ISREG(lo_dentry->d_inode->i_mode))
@@ -877,5 +877,5 @@
 			break;
 		}
-		err = put_user(loop_sizes[lo->lo_number] << 1, (unsigned long *) arg);
+		err = put_user((unsigned long)loop_sizes[lo->lo_number] << 1, (unsigned long *) arg);
 		break;
 	case BLKGETSIZE64:
@@ -1019,5 +1019,5 @@
 		return -ENOMEM;
 
-	loop_sizes = kmalloc(max_loop * sizeof(unsigned long), GFP_KERNEL);
+	loop_sizes = kmalloc(max_loop * sizeof(int), GFP_KERNEL);
 	if (!loop_sizes)
 		goto out_sizes;
@@ -1039,5 +1039,5 @@
 	}
 
-	memset(loop_sizes, 0, max_loop * sizeof(unsigned long));
+	memset(loop_sizes, 0, max_loop * sizeof(int));
 	memset(loop_blksizes, 0, max_loop * sizeof(int));
 	blk_size[MAJOR_NR] = loop_sizes;

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

only message in thread, other threads:[~2001-10-17 18:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-17 18:40 [PATCH] 2.4.13pre3: loop uses wrong type for blk_size[] Chip Salzenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox