bdev/null: Fix infinite loop in configuration parsing

Invalid configuration file parameter in Null bdev section results in
infinite loop.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464775 (master)

(cherry picked from commit e06e34be1d)
Change-Id: I79a1a53e0f4d76a8724e7a624cabda7250b511c5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467131
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Evgeniy Kochetov 2019-08-01 12:05:49 +00:00 committed by Ben Walker
parent 077ae9152d
commit 0b60d077cb

View File

@ -1,8 +1,8 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
* Copyright (c) Intel Corporation. All rights reserved.
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -318,8 +318,7 @@ bdev_null_initialize(void)
goto end;
}
i = 0;
while (true) {
for (i = 0; ; ++i) {
val = spdk_conf_section_get_nval(sp, "Dev", i);
if (val == NULL) {
break;
@ -362,8 +361,6 @@ bdev_null_initialize(void)
SPDK_ERRLOG("Could not create null bdev\n");
goto end;
}
i++;
}
end:
if (rc) {