From: Dongwoo Lee Date: Thu, 25 Aug 2022 04:44:44 +0000 (+0900) Subject: resource: system: Fix to check NULL for private data X-Git-Tag: submit/tizen/20220829.102006~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=121611a9795469f1510701508997e1b3a13fb939;p=platform%2Fcore%2Fsystem%2Fpass.git resource: system: Fix to check NULL for private data Change-Id: I70cb0cfd108ec165d8a863cf6c4c35ea42571b69 Signed-off-by: Dongwoo Lee --- diff --git a/src/resource/resource-system.c b/src/resource/resource-system.c index cc2b8a6..42c7d43 100644 --- a/src/resource/resource-system.c +++ b/src/resource/resource-system.c @@ -306,10 +306,14 @@ static void system_delete(struct resource *res) static int system_driver_prepare_update(struct resource *res) { - struct system_resource_data *sysdata = get_resource_privdata(res); + struct system_resource_data *sysdata; const char *res_name = get_resource_name(res); int ret; + sysdata = get_resource_privdata(res); + if (!sysdata) + return -EINVAL; + /* Get the per-cpu utilization */ memcpy(sysdata->prev_cpus, sysdata->curr_cpus, sizeof(struct cpu_stat) * sysdata->num_possible_cpus);