From 90ea5d9e5df14cae3f20d8ea4d1f251d0d40bc63 Mon Sep 17 00:00:00 2001 From: Jens Remus Date: Tue, 5 Sep 2017 22:06:20 +0200 Subject: [PATCH] fdasd: check array limits before indexing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found using Cppcheck: [fdasd/fdasd.c:261]: (style) Array index 'from' is used before limits check. Cc: Stefan Haberland Cc: Jan Hoeppner Signed-off-by: Jens Remus Reviewed-by: Jan Höppner Signed-off-by: Jan Höppner --- fdasd/fdasd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdasd/fdasd.c b/fdasd/fdasd.c index ffc1e9dc..a50192a6 100644 --- a/fdasd/fdasd.c +++ b/fdasd/fdasd.c @@ -258,7 +258,7 @@ static void fdasd_check_volser(char *volser, int devno) { int from, to; - for (from = 0, to = 0; volser[from] && from < VOLSER_LENGTH; from++) + for (from = 0, to = 0; from < VOLSER_LENGTH && volser[from]; from++) if ((volser[from] >= 0x23 && volser[from] <= 0x25) || /* # $ % */ (volser[from] >= 0x30 &&