public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] Trivial fix to phram.c
@ 2004-08-04 19:41 Ari Rahikkala
  2004-08-05 12:52 ` Jörn Engel
  0 siblings, 1 reply; 7+ messages in thread
From: Ari Rahikkala @ 2004-08-04 19:41 UTC (permalink / raw)
  To: linux-mtd

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

I'm not sure if gmail likes to mangle stuff a lot, so I'll include
this patch both inline and as an attachment.

--- linux-2.6.7/drivers/mtd/devices/phram.c     2004-08-04
22:29:04.850552576 +0300
+++ linux-2.6.7/drivers/mtd/devices/phram.c.argument_fix       
2004-08-04 22:25:04.557082736 +0300
@@ -231,14 +231,15 @@
 
 static int phram_setup(const char *val, struct kernel_param *kp)
 {
-       char buf[64+12+12], *str = buf;
+       const int buflen = 88;
+       char buf[buflen], *str = buf;
        char *token[3];
        char *name;
        uint32_t start;
        uint32_t len;
        int i, ret;
 
-       if (strnlen(val, sizeof(str)) >= sizeof(str))
+       if (strnlen(val, buflen) >= buflen)
                parse_err("parameter too long\n");
 
        strcpy(str, val);

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: argumentfix.diff --]
[-- Type: text/x-patch; name="argumentfix.diff", Size: 605 bytes --]

--- linux-2.6.7/drivers/mtd/devices/phram.c	2004-08-04 22:29:04.850552576 +0300
+++ linux-2.6.7/drivers/mtd/devices/phram.c.argument_fix	2004-08-04 22:25:04.557082736 +0300
@@ -231,14 +231,15 @@
 
 static int phram_setup(const char *val, struct kernel_param *kp)
 {
-	char buf[64+12+12], *str = buf;
+	const int buflen = 88;
+	char buf[buflen], *str = buf;
 	char *token[3];
 	char *name;
 	uint32_t start;
 	uint32_t len;
 	int i, ret;
 
-	if (strnlen(val, sizeof(str)) >= sizeof(str))
+	if (strnlen(val, buflen) >= buflen)
 		parse_err("parameter too long\n");
 
 	strcpy(str, val);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-08-05 14:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-04 19:41 [PATCH] Trivial fix to phram.c Ari Rahikkala
2004-08-05 12:52 ` Jörn Engel
2004-08-05 13:05   ` David Woodhouse
2004-08-05 14:14     ` Jörn Engel
2004-08-05 14:25       ` David Woodhouse
2004-08-05 14:30         ` Jörn Engel
2004-08-05 14:41           ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox