From a1db08160dc18132010b9742e211e165dbcb2bb8 Mon Sep 17 00:00:00 2001 From: Jens Remus Date: Tue, 5 Sep 2017 22:37:40 +0200 Subject: [PATCH] zipl: check array limits before indexing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves Cppcheck warning: [zipl/boot/menu.c:126]: (style) Array index 'i' is used before limits check. Cc: Stefan Haberland Cc: Peter Oberparleiter Signed-off-by: Jens Remus Reviewed-by: Jan Höppner Signed-off-by: Jan Höppner --- zipl/boot/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zipl/boot/menu.c b/zipl/boot/menu.c index 3f686204..db2cf45b 100644 --- a/zipl/boot/menu.c +++ b/zipl/boot/menu.c @@ -3,7 +3,7 @@ * * Bootmenu Subroutines * - * Copyright IBM Corp. 2013, 2017 + * Copyright IBM Corp. 2013, 2018 * * s390-tools is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -123,7 +123,7 @@ static int menu_param(unsigned long *value) /* no number, check for keyword */ i = 0; /* skip leading whitespaces */ - while (ebc_isspace(loadparm[i]) && (i < PARAM_SIZE)) + while ((i < PARAM_SIZE) && ebc_isspace(loadparm[i])) i++; if (!strncmp(&loadparm[i], "PROMPT", 6)) {