Commit 241f2907 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

json_config: do not attempt to resolve JSON that failed decode



When config entry fails spdk_json_decode_object(),
that basically means incorrectly formatted JSON config.
Decode object is simple enough here - 'method' and optional 'params'.

Before this change SPDK_ERRLOG printed garbage, rather than JSON
object that failed the decode.

We actually should not do it at all:
- the object is not formatted right already
- it might be the last object, so spdk_json_next() won't work

It was not usefull, so this patch removes it.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ife67ac0d9a1a66d567bfbdd5896e893f3e8cb3ca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3257


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent cebf307b
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -367,10 +367,7 @@ app_json_config_load_subsystem_config_entry(void *_ctx)

	if (spdk_json_decode_object(ctx->config_it, jsonrpc_cmd_decoders,
				    SPDK_COUNTOF(jsonrpc_cmd_decoders), &cfg)) {
		params_end = spdk_json_next(ctx->config_it);
		assert(params_end != NULL);
		params_len = params_end->start - ctx->config->start + 1;
		SPDK_ERRLOG("Failed to decode config entry: %.*s!\n", (int)params_len, (char *)ctx->config_it);
		SPDK_ERRLOG("Failed to decode config entry\n");
		app_json_config_load_done(ctx, -EINVAL);
		goto out;
	}