All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: sparclinux@vger.kernel.org
Subject: [PATCH] arch/sparc: additional len check in loop for prom_getbootargs
Date: Thu, 08 Nov 2012 03:41:39 +0000	[thread overview]
Message-ID: <509B29F3.2040006@asianux.com> (raw)


  when cp >= barg_buf + BARG_LEN-2, it only break internel loop (while)
  but outside loop (for) still has effect, and "*cp++ = ' '" repeating
  so need additional checking for it.


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/sparc/prom/bootstr_32.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/sparc/prom/bootstr_32.c b/arch/sparc/prom/bootstr_32.c
index f5ec32e..25cda1c 100644
--- a/arch/sparc/prom/bootstr_32.c
+++ b/arch/sparc/prom/bootstr_32.c
@@ -40,6 +40,10 @@ prom_getbootargs(void)
 				*cp++ = *arg++;
 			}
 			*cp++ = ' ';
+			if(cp >= barg_buf + BARG_LEN-1){
+				/* We might issue a warning here. */
+				break;
+			}
 		}
 		*cp = 0;
 		break;
-- 
1.7.9.5

             reply	other threads:[~2012-11-08  3:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08  3:41 Chen Gang [this message]
2012-11-08 16:33 ` [PATCH] arch/sparc: additional len check in loop for prom_getbootargs Sam Ravnborg
2012-11-09  3:15 ` Chen Gang
2012-11-09  3:16 ` David Miller
2012-11-09  3:25 ` Chen Gang
2012-11-09  5:06 ` Julian Calaby
2012-11-09  5:29 ` Chen Gang
2012-11-13  3:06 ` Chen Gang
2012-11-13  3:25 ` Chen Gang
2012-11-13  4:46 ` Chen Gang
2012-11-13  5:06 ` David Miller
2012-11-13  5:29 ` Chen Gang

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=509B29F3.2040006@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=sparclinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.