mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: lkml <linux-kernel@vger.kernel.org>
Subject: Fw: Re: top stack (l)users for 2.5.67
Date: Mon, 14 Apr 2003 17:18:15 -0700	[thread overview]
Message-ID: <20030414171815.726e1d21.rddunlap@osdl.org> (raw)

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

Hi,

I'm reposting these 2 patches in case anyone is interested in them.

~Randy


Begin forwarded message:

Date: Mon, 14 Apr 2003 13:26:12 -0700
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: Jörn Engel <joern@wohnheim.fh-wedel.de>
Subject: Re: top stack (l)users for 2.5.67


On Mon, 14 Apr 2003 21:44:42 +0200 Jörn Engel <joern@wohnheim.fh-wedel.de> wrote:

| On Mon, 14 April 2003 12:38:10 -0700, Randy.Dunlap wrote:
| > On Mon, 14 Apr 2003 19:30:47 +0200 Jörn Engel <joern@wohnheim.fh-wedel.de> wrote:
| > 
| > 
| > | 0xc05e2733 ida_ioctl:                                    sub    $0x54c,%esp
| > 
| > patch posted 2003.APR.03 (on lkml); Steve Cameron saw it...
| > 
| > | 0xc0fb00e3 device_new_if:                                sub    $0x520,%esp
| > 
| > patch posted 2003.APR.03 (on linux-net);
| > no reply from Nenad Corbic (ncorbic@sangoma.com)
| 
| Hm, all these stack reduction patches are relevant to -je as well.
| Could I have a copy of those two?

[-- Attachment #2: wan-stack.patch --]
[-- Type: application/octet-stream, Size: 3245 bytes --]

patch_name:	wan-stack.patch
patch_version:	2003-04-02.20:59:49
author:		Randy.Dunlap <rddunlap@osdl.org>
description:	reduce stack in net/wanrouter/wanmain.c::device_new_if()
		from 0x520 to 0x24;
product:	Linux
product_versions: 2.5.66
changelog:	allocate and free the <wanif_conf_t> data;
maintainer:	Gideon Hack (no email address listed)
diffstat:	=
 net/wanrouter/wanmain.c |   52 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 34 insertions(+), 18 deletions(-)


diff -Naur ./net/wanrouter/wanmain.c%WANSTK ./net/wanrouter/wanmain.c
--- ./net/wanrouter/wanmain.c%WANSTK	2003-03-24 14:01:11.000000000 -0800
+++ ./net/wanrouter/wanmain.c	2003-04-02 20:49:58.000000000 -0800
@@ -660,7 +660,7 @@
 
 static int device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf)
 {
-	wanif_conf_t conf;
+	wanif_conf_t *cnf;
 	netdevice_t *dev=NULL;
 #ifdef CONFIG_WANPIPE_MULTPPP
 	struct ppp_device *pppdev=NULL;
@@ -670,37 +670,51 @@
 	if ((wandev->state == WAN_UNCONFIGURED) || (wandev->new_if == NULL))
 		return -ENODEV;
 
-	if (copy_from_user(&conf, u_conf, sizeof(wanif_conf_t)))
-		return -EFAULT;
+	cnf = kmalloc(sizeof(wanif_conf_t), GFP_KERNEL);
+	if (!cnf)
+		return -ENOBUFS;
+
+	if (copy_from_user(cnf, u_conf, sizeof(wanif_conf_t))) {
+		err = -EFAULT;
+		goto conffree;
+	}
 
-	if (conf.magic != ROUTER_MAGIC)
-		return -EINVAL;
+	if (cnf->magic != ROUTER_MAGIC) {
+		err = -EINVAL;
+		goto conffree;
+	}
 
-	if (conf.config_id == WANCONFIG_MPPP) {
+	if (cnf->config_id == WANCONFIG_MPPP) {
 #ifdef CONFIG_WANPIPE_MULTPPP
 		pppdev = kmalloc(sizeof(struct ppp_device), GFP_KERNEL);
-		if (pppdev == NULL)
-			return -ENOBUFS;
+		if (pppdev == NULL) {
+			err = -ENOBUFS;
+			goto conffree;
+		}
 		memset(pppdev, 0, sizeof(struct ppp_device));
 		pppdev->dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL);
 		if (pppdev->dev == NULL) {
 			kfree(pppdev);
-			return -ENOBUFS;
+			err = -ENOBUFS;
+			goto conffree;
 		}
 		memset(pppdev->dev, 0, sizeof(netdevice_t));
-		err = wandev->new_if(wandev, (netdevice_t *)pppdev, &conf);
+		err = wandev->new_if(wandev, (netdevice_t *)pppdev, cnf);
 		dev = pppdev->dev;
 #else
 		printk(KERN_INFO "%s: Wanpipe Mulit-Port PPP support has not been compiled in!\n",
 				wandev->name);
-		return -EPROTONOSUPPORT;
+		err = -EPROTONOSUPPORT;
+		goto conffree;
 #endif
 	} else {
 		dev = kmalloc(sizeof(netdevice_t), GFP_KERNEL);
-		if (dev == NULL)
-			return -ENOBUFS;
+		if (dev == NULL) {
+			err = -ENOBUFS;
+			goto conffree;
+		}
 		memset(dev, 0, sizeof(netdevice_t));
-		err = wandev->new_if(wandev, dev, &conf);
+		err = wandev->new_if(wandev, dev, cnf);
 	}
 
 	if (!err) {
@@ -739,7 +753,8 @@
 				++wandev->ndev;
 
 				unlock_adapter_irq(&wandev->lock, &smp_flags);
-				return 0;	/* done !!! */
+				err = 0;	/* done !!! */
+				goto conffree;
 			}
 		}
 		if (wandev->del_if)
@@ -752,18 +767,19 @@
 		dev->priv = NULL;
 	}
 
-
 #ifdef CONFIG_WANPIPE_MULTPPP
-	if (conf.config_id == WANCONFIG_MPPP)
+	if (cnf->config_id == WANCONFIG_MPPP)
 		kfree(pppdev);
 	else
 		kfree(dev);
 #else
 	/* Sync PPP is disabled */
-	if (conf.config_id != WANCONFIG_MPPP)
+	if (cnf->config_id != WANCONFIG_MPPP)
 		kfree(dev);
 #endif
 
+ conffree:
+	kfree(cnf);
 	return err;
 }
 

[-- Attachment #3: cpqarray-stack.patch --]
[-- Type: application/octet-stream, Size: 1667 bytes --]

patch_name:	cpqarray-stack.patch
patch_version:	2003-04-02.21:10:01
author:		Randy.Dunlap <rddunlap@osdl.org>
description:	reduce stack in block/cqparray.c::ida_ioctl()
		from 0x550 to 0x48;
product:	Linux
product_versions: linux-2566
changelog:	allocate and free <ida_ioctl_t>
maintainer:	Steve Cameron: arrays@hp.com, steve.cameron@hp.com
diffstat:	=
 drivers/block/cpqarray.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)


diff -Naur ./drivers/block/cpqarray.c%IDAIOC ./drivers/block/cpqarray.c
--- ./drivers/block/cpqarray.c%IDAIOC	2003-03-24 14:00:03.000000000 -0800
+++ ./drivers/block/cpqarray.c	2003-04-02 20:05:57.000000000 -0800
@@ -1021,7 +1021,7 @@
 	int diskinfo[4];
 	struct hd_geometry *geo = (struct hd_geometry *)arg;
 	ida_ioctl_t *io = (ida_ioctl_t*)arg;
-	ida_ioctl_t my_io;
+	ida_ioctl_t *my_io;
 
 	switch(cmd) {
 	case HDIO_GETGEO:
@@ -1046,11 +1046,19 @@
 		return 0;
 	case IDAPASSTHRU:
 		if (!capable(CAP_SYS_RAWIO)) return -EPERM;
-		if (copy_from_user(&my_io, io, sizeof(my_io)))
-			return -EFAULT;
-		error = ida_ctlr_ioctl(ctlr, dsk, &my_io);
-		if (error) return error;
-		return copy_to_user(io, &my_io, sizeof(my_io)) ? -EFAULT : 0;
+		my_io = kmalloc(sizeof(ida_ioctl_t), GFP_KERNEL);
+		if (!my_io)
+			return -ENOMEM;
+		if (copy_from_user(my_io, io, sizeof(*my_io))) {
+			error = -EFAULT;
+			goto iocfree;
+		}
+		error = ida_ctlr_ioctl(ctlr, dsk, my_io);
+		if (error) goto iocfree;
+		error = copy_to_user(io, my_io, sizeof(*my_io)) ? -EFAULT : 0;
+  iocfree:
+		kfree(my_io);
+		return error;
 	case IDAGETCTLRSIG:
 		if (!arg) return -EINVAL;
 		put_user(hba[ctlr]->ctlr_sig, (int*)arg);

                 reply	other threads:[~2003-04-15  0:07 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=20030414171815.726e1d21.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®