mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: andersg@0x63.nu
To: linux-kernel@vger.kernel.org
Cc: torvalds@transmeta.com
Subject: [PATCH] 2.5.2-pre3 lvm compilefix+lv_t off stack
Date: Fri, 28 Dec 2001 18:40:54 +0100	[thread overview]
Message-ID: <20011228174054.GC20899@h55p111.delphi.afb.lu.se> (raw)

This patch removes another lv_t on the stack (hunk 1+2)
and changes lvm_get_blksize to block_size (making lvm compile again) (hunk 3)

//anders/g

--- linux-2.5.2-pre3/drivers/md/lvm.c	Fri Dec 28 09:03:31 2001
+++ linux-2.5.2-pre3-lvmfix-reiserfix/drivers/md/lvm.c	Fri Dec 28 08:44:50 2001
@@ -549,10 +549,11 @@
 		  uint command, ulong a)
 {
 	int minor = MINOR(inode->i_rdev);
+	int ret;
 	uint extendable, l, v;
 	void *arg = (void *) a;
-	lv_t lv;
 	vg_t* vg_ptr = vg[VG_CHR(minor)];
+	lv_t *userlv;
 
 	/* otherwise cc will complain about unused variables */
 	(void) lvm_lock;
@@ -681,30 +682,43 @@
 	case LV_REDUCE:
 	case LV_REMOVE:
 	case LV_RENAME:
+		
 		/* create, extend, reduce, remove or rename a logical volume */
 		if (vg_ptr == NULL) return -ENXIO;
 		if (copy_from_user(&lv_req, arg, sizeof(lv_req)) != 0)
 			return -EFAULT;
 
+		if ((userlv = kmalloc(sizeof(lv_t),GFP_KERNEL)) == NULL) {
+			printk(KERN_CRIT
+			       "%s -- LV_RENAME: kmalloc error LV at line %d\n",
+			       lvm_name, __LINE__);
+			return -ENOMEM;
+		}
+
 		if (command != LV_REMOVE) {
-			if (copy_from_user(&lv, lv_req.lv, sizeof(lv_t)) != 0)
+			if (copy_from_user(userlv, lv_req.lv, sizeof(lv_t)) != 0)
 				return -EFAULT;
 		}
 		switch (command) {
 		case LV_CREATE:
-			return lvm_do_lv_create(minor, lv_req.lv_name, &lv);
+			ret=lvm_do_lv_create(minor, lv_req.lv_name, userlv);
 
 		case LV_EXTEND:
 		case LV_REDUCE:
-			return lvm_do_lv_extend_reduce(minor, lv_req.lv_name, &lv);
+			ret=lvm_do_lv_extend_reduce(minor, lv_req.lv_name, userlv);
+			break;
 		case LV_REMOVE:
-			return lvm_do_lv_remove(minor, lv_req.lv_name, -1);
+			ret=lvm_do_lv_remove(minor, lv_req.lv_name, -1);
+			break;
 
 		case LV_RENAME:
-			return lvm_do_lv_rename(vg_ptr, &lv_req, &lv);
+			ret=lvm_do_lv_rename(vg_ptr, &lv_req, userlv);
+			break;
+		default:
+			ret=-EINVAL;
 		}
-
-
+		kfree(userlv);
+		return ret;
 
 
 	case LV_STATUS_BYNAME:
@@ -1046,7 +1060,7 @@
 
 	memset(&bio,0,sizeof(bio));
 	bio.bi_dev = inode->i_rdev;
-	bio.bi_size = lvm_get_blksize(bio.bi_dev); /* NEEDED by bio_sectors */
+	bio.bi_size = block_size(bio.bi_dev);
  	bio.bi_sector = block * bio_sectors(&bio);
 	bio.bi_rw = READ;
 	if ((err=lvm_map(&bio)) < 0)  {




                 reply	other threads:[~2001-12-28 17:41 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=20011228174054.GC20899@h55p111.delphi.afb.lu.se \
    --to=andersg@0x63.nu \
    --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

all inboxes | Powered by JetHome®