public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chip Salzenberg <chip@pobox.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.4.13pre3: loop uses wrong type for blk_size[]
Date: Wed, 17 Oct 2001 11:40:46 -0700	[thread overview]
Message-ID: <20011017114046.A3880@perlsupport.com> (raw)

[-- 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;

                 reply	other threads:[~2001-10-17 18:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20011017114046.A3880@perlsupport.com \
    --to=chip@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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