fdasd: check array limits before indexing

Found using Cppcheck:
[fdasd/fdasd.c:261]: (style) Array index 'from' is used before limits check.

Cc: Stefan Haberland <sth@linux.ibm.com>
Cc: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jens Remus
2017-09-05 22:06:20 +02:00
committed by Jan Höppner
parent 6accffd583
commit 90ea5d9e5d

View File

@@ -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 &&