lkml.org 
[lkml]   [2005]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Realtime Preemption, 2.6.12, Beginners Guide?

> (gdb) ####################################
> (gdb) # c02decd6, stack size: 460 bytes #
> (gdb) ####################################
> (gdb) 0xc02decd6 is in ip_getsockopt (net/ipv4/ip_sockglue.c:877).

----
this patch reduces the stack footprint of ip_getsockopt() from 460 bytes
to 188 bytes. (note: needs review & testing because i did not excercise
this multicast codepath.)
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Index: linux/net/ipv4/ip_sockglue.c
===================================================================
--- linux.orig/net/ipv4/ip_sockglue.c
+++ linux/net/ipv4/ip_sockglue.c
@@ -1006,20 +1024,28 @@ int ip_getsockopt(struct sock *sk, int l
}
case MCAST_MSFILTER:
{
- struct group_filter gsf;
+ struct group_filter *gsf;
int err;

+ gsf = kmalloc(sizeof(*gsf), GFP_KERNEL);
+ if (!gsf) {
+ release_sock(sk);
+ return -ENOMEM;
+ }
if (len < GROUP_FILTER_SIZE(0)) {
release_sock(sk);
+ kfree(gsf);
return -EINVAL;
}
- if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) {
+ if (copy_from_user(gsf, optval, GROUP_FILTER_SIZE(0))) {
release_sock(sk);
+ kfree(gsf);
return -EFAULT;
}
- err = ip_mc_gsfget(sk, &gsf,
+ err = ip_mc_gsfget(sk, gsf,
(struct group_filter __user *)optval, optlen);
release_sock(sk);
+ kfree(gsf);
return err;
}
case IP_PKTOPTIONS:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-07-09 15:17    [from the cache]
©2003-2011 Jasper Spaans