public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ari Rahikkala <ari.rahikkala@gmail.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] Trivial fix to phram.c
Date: Wed, 4 Aug 2004 22:41:32 +0300	[thread overview]
Message-ID: <e2041ca104080412415a9ce4e8@mail.gmail.com> (raw)

[-- 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);

             reply	other threads:[~2004-08-04 19:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-04 19:41 Ari Rahikkala [this message]
2004-08-05 12:52 ` [PATCH] Trivial fix to phram.c 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

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=e2041ca104080412415a9ce4e8@mail.gmail.com \
    --to=ari.rahikkala@gmail.com \
    --cc=linux-mtd@lists.infradead.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