From 193e7f5973e8a0ff7a4f8ebc542fcb9853a30d0d Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 16 Nov 2015 00:42:29 +0100 Subject: [PATCH] config: check vdef pointer before dereference Coverity notices we check for v_def != NULL elsewhere, so it thinks it may be possibly NULL also here. --- lib/config/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/config/config.c b/lib/config/config.c index 1298b40cb..d69f1f750 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -891,7 +891,7 @@ static int _check_value_differs_from_default(struct cft_check_handle *handle, } break; case DM_CFG_EMPTY_ARRAY: - diff = v_def->type != DM_CFG_EMPTY_ARRAY; + diff = (v_def && (v_def->type != DM_CFG_EMPTY_ARRAY)); break; default: log_error(INTERNAL_ERROR "inconsistent state reached in _check_value_differs_from_default");