All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch/sparc: additional len check in loop for prom_getbootargs
@ 2012-11-08  3:41 Chen Gang
  2012-11-08 16:33 ` Sam Ravnborg
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Chen Gang @ 2012-11-08  3:41 UTC (permalink / raw)
  To: sparclinux


  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

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

end of thread, other threads:[~2012-11-13  5:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-08  3:41 [PATCH] arch/sparc: additional len check in loop for prom_getbootargs Chen Gang
2012-11-08 16:33 ` 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

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.