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>
Change-Id: I79a1a53e0f4d76a8724e7a624cabda7250b511c5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464775
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Evgeniy Kochetov 2019-08-01 12:05:49 +00:00 committed by Jim Harris
parent cdde42d52e
commit e06e34be1d

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) {