From 69cbc0464d87bfa38c0a4fe4d8bb751c1ec8cedf Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Thu, 30 May 2013 10:35:34 +0800 Subject: [PATCH] [IA64] hpsim: Fix check for overlong simscsi prefix. When "strlen(s) > MAX_ROOT_LEN", it has already said to use the default value, but in fact, it still use the input value. If happens, next sprintf() for 'fname' in simscsi_queuecommand_lck() may be memory overflow. Signed-off-by: Chen Gang Signed-off-by: Tony Luck --- arch/ia64/hp/sim/simscsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c index 331de723c676..3a428f19a001 100644 --- a/arch/ia64/hp/sim/simscsi.c +++ b/arch/ia64/hp/sim/simscsi.c @@ -88,8 +88,8 @@ simscsi_setup (char *s) if (strlen(s) > MAX_ROOT_LEN) { printk(KERN_ERR "simscsi_setup: prefix too long---using default %s\n", simscsi_root); - } - simscsi_root = s; + } else + simscsi_root = s; return 1; }