From: "Randy.Dunlap" <rddunlap@osdl.org>
To: netdev@oss.sgi.com, jgarzik <jgarzik@pobox.com>, corey@world.std.com
Subject: [PATCH] ray_cs: reduce stack usage
Date: Thu, 27 Jan 2005 21:49:46 -0800 [thread overview]
Message-ID: <41F9D27A.8090204@osdl.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
ray_cs: reduce local stack usage in ray_dev_ioctl
from 1048 to 468 (on i386) by making 'range' kmalloc-ed
instead of an automatic stack variable.
struct iw_range range; // 564 bytes
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
diffstat:=
drivers/net/wireless/ray_cs.c | 35 +++++++++++++++++++++--------------
1 files changed, 21 insertions(+), 14 deletions(-)
[-- Attachment #2: raycs_stack1.patch --]
[-- Type: text/x-patch, Size: 2487 bytes --]
diff -Naurp ./drivers/net/wireless/ray_cs.c~raycs_stack ./drivers/net/wireless/ray_cs.c
--- ./drivers/net/wireless/ray_cs.c~raycs_stack 2005-01-27 20:38:05.678592648 -0800
+++ ./drivers/net/wireless/ray_cs.c 2005-01-27 21:05:51.637328424 -0800
@@ -1467,33 +1467,39 @@ static int ray_dev_ioctl(struct net_devi
/* Basic checking... */
if(wrq->u.data.pointer != (caddr_t) 0)
{
- struct iw_range range;
- memset((char *) &range, 0, sizeof(struct iw_range));
+ struct iw_range *range;
+ range = kmalloc(sizeof(struct iw_range), GFP_KERNEL);
+ if (!range) {
+ err = -ENOMEM;
+ goto ioc_out;
+ }
+ memset((char *) range, 0, sizeof(struct iw_range));
/* Set the length (very important for backward compatibility) */
wrq->u.data.length = sizeof(struct iw_range);
#if WIRELESS_EXT > 10
/* Set the Wireless Extension versions */
- range.we_version_compiled = WIRELESS_EXT;
- range.we_version_source = 9;
+ range->we_version_compiled = WIRELESS_EXT;
+ range->we_version_source = 9;
#endif /* WIRELESS_EXT > 10 */
/* Set information in the range struct */
- range.throughput = 1.1 * 1000 * 1000; /* Put the right number here */
- range.num_channels = hop_pattern_length[(int)country];
- range.num_frequency = 0;
- range.max_qual.qual = 0;
- range.max_qual.level = 255; /* What's the correct value ? */
- range.max_qual.noise = 255; /* Idem */
- range.num_bitrates = 2;
- range.bitrate[0] = 1000000; /* 1 Mb/s */
- range.bitrate[1] = 2000000; /* 2 Mb/s */
+ range->throughput = 1.1 * 1000 * 1000; /* Put the right number here */
+ range->num_channels = hop_pattern_length[(int)country];
+ range->num_frequency = 0;
+ range->max_qual.qual = 0;
+ range->max_qual.level = 255; /* What's the correct value ? */
+ range->max_qual.noise = 255; /* Idem */
+ range->num_bitrates = 2;
+ range->bitrate[0] = 1000000; /* 1 Mb/s */
+ range->bitrate[1] = 2000000; /* 2 Mb/s */
/* Copy structure to the user buffer */
- if(copy_to_user(wrq->u.data.pointer, &range,
+ if(copy_to_user(wrq->u.data.pointer, range,
sizeof(struct iw_range)))
err = -EFAULT;
+ kfree(range);
}
break;
@@ -1632,6 +1638,7 @@ static int ray_dev_ioctl(struct net_devi
DEBUG(0,"ray_dev_ioctl cmd = 0x%x\n", cmd);
err = -EOPNOTSUPP;
}
+ioc_out:
return err;
} /* end ray_dev_ioctl */
/*===========================================================================*/
reply other threads:[~2005-01-28 5:49 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=41F9D27A.8090204@osdl.org \
--to=rddunlap@osdl.org \
--cc=corey@world.std.com \
--cc=jgarzik@pobox.com \
--cc=netdev@oss.sgi.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;
as well as URLs for NNTP newsgroup(s).