netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Olsson <Robert.Olsson@data.slu.se>
To: davem@davemloft.net
Cc: "Randy.Dunlap" <rddunlap@osdl.org>,
	Robert Olsson <Robert.Olsson@data.slu.se>,
	Francois Romieu <romieu@fr.zoreil.com>,
	netdev <netdev@oss.sgi.com>
Subject: Re: [PATCH] pktgen: reduce stack usage
Date: Tue, 22 Feb 2005 16:41:31 +0100	[thread overview]
Message-ID: <16923.21163.112945.608974@robur.slu.se> (raw)
In-Reply-To: <421A0880.5070205@osdl.org>


Randy.Dunlap writes:
 > >  Here is version with just one buffer.
 > 
 > Yep, even better:  few changes + using sizeof.

 Hello.

 OK! Then we ask DaveM to apply the patch.

				    --ro


 
--- net/core/pktgen.c.050221	2005-02-21 14:02:40.000000000 +0100
+++ net/core/pktgen.c	2005-02-21 15:02:44.000000000 +0100
@@ -151,7 +151,7 @@
 #include <asm/timex.h>
 
 
-#define VERSION  "pktgen v2.57: Packet Generator for packet performance testing.\n"
+#define VERSION  "pktgen v2.58: Packet Generator for packet performance testing.\n"
 
 /* #define PG_DEBUG(a) a */
 #define PG_DEBUG(a) 
@@ -811,6 +811,7 @@
         struct pktgen_dev *pkt_dev = (struct pktgen_dev*)(data);
         char* pg_result = NULL;
         int tmp = 0;
+	char buf[128];
         
         pg_result = &(pkt_dev->result[0]);
         
@@ -1071,7 +1072,6 @@
 		return count;
 	}
 	if (!strcmp(name, "dst_min") || !strcmp(name, "dst")) {
-                char buf[IP_NAME_SZ];
 		len = strn_len(&user_buffer[i], sizeof(pkt_dev->dst_min) - 1);
                 if (len < 0) { return len; }
 
@@ -1091,7 +1091,6 @@
 		return count;
 	}
 	if (!strcmp(name, "dst_max")) {
-                char buf[IP_NAME_SZ];
 		len = strn_len(&user_buffer[i], sizeof(pkt_dev->dst_max) - 1);
                 if (len < 0) { return len; }
 
@@ -1112,9 +1111,7 @@
 		return count;
 	}
 	if (!strcmp(name, "dst6")) {
-                char buf[128];
-
-		len = strn_len(&user_buffer[i], 128 - 1);
+		len = strn_len(&user_buffer[i], sizeof(buf) - 1);
                 if (len < 0) return len; 
 
 		pkt_dev->flags |= F_IPV6;
@@ -1136,9 +1133,7 @@
 		return count;
 	}
 	if (!strcmp(name, "dst6_min")) {
-                char buf[128];
-
-		len = strn_len(&user_buffer[i], 128 - 1);
+		len = strn_len(&user_buffer[i], sizeof(buf) - 1);
                 if (len < 0) return len; 
 
 		pkt_dev->flags |= F_IPV6;
@@ -1159,9 +1154,7 @@
 		return count;
 	}
 	if (!strcmp(name, "dst6_max")) {
-                char buf[128];
-
-		len = strn_len(&user_buffer[i], 128 - 1);
+		len = strn_len(&user_buffer[i], sizeof(buf) - 1);
                 if (len < 0) return len; 
 
 		pkt_dev->flags |= F_IPV6;
@@ -1181,9 +1174,7 @@
 		return count;
 	}
 	if (!strcmp(name, "src6")) {
-                char buf[128];
-
-		len = strn_len(&user_buffer[i], 128 - 1);
+		len = strn_len(&user_buffer[i], sizeof(buf) - 1);
                 if (len < 0) return len; 
 
 		pkt_dev->flags |= F_IPV6;
@@ -1205,7 +1196,6 @@
 		return count;
 	}
 	if (!strcmp(name, "src_min")) {
-                char buf[IP_NAME_SZ];
 		len = strn_len(&user_buffer[i], sizeof(pkt_dev->src_min) - 1);
                 if (len < 0) { return len; }
                 if (copy_from_user(buf, &user_buffer[i], len))
@@ -1224,7 +1214,6 @@
 		return count;
 	}
 	if (!strcmp(name, "src_max")) {
-                char buf[IP_NAME_SZ];
 		len = strn_len(&user_buffer[i], sizeof(pkt_dev->src_max) - 1);
                 if (len < 0) { return len; }
                 if (copy_from_user(buf, &user_buffer[i], len))

  reply	other threads:[~2005-02-22 15:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-18 21:42 [PATCH] pktgen: reduce stack usage Randy.Dunlap
2005-02-18 22:11 ` Francois Romieu
2005-02-18 22:20   ` Randy.Dunlap
2005-02-18 22:37   ` Randy.Dunlap
2005-02-21 14:13     ` Robert Olsson
2005-02-21 16:12       ` Randy.Dunlap
2005-02-22 15:41         ` Robert Olsson [this message]
2005-02-24  4:31           ` David S. Miller
2005-02-19  2:56 ` Ben Greear
2005-02-21 16:27   ` Randy.Dunlap

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=16923.21163.112945.608974@robur.slu.se \
    --to=robert.olsson@data.slu.se \
    --cc=davem@davemloft.net \
    --cc=netdev@oss.sgi.com \
    --cc=rddunlap@osdl.org \
    --cc=romieu@fr.zoreil.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).