From: Yunhee Seo Date: Mon, 6 Nov 2023 01:46:15 +0000 (+0900) Subject: power: Add callback parameter check X-Git-Tag: accepted/tizen/unified/20231107.172855^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80374812948cd8cdbf1972db84402bf9fc9a75c2;p=platform%2Fcore%2Fapi%2Fdevice.git power: Add callback parameter check When the callback parameter is null, it causes abnormal operation. To avoid this, callback parameter check is necessary. Change-Id: I5bfdf967ed5abea9563cbe070d8157b47d5ec7b0 Signed-off-by: Yunhee Seo --- diff --git a/src/power-internal.c b/src/power-internal.c index 631e11a..74d2b1e 100644 --- a/src/power-internal.c +++ b/src/power-internal.c @@ -201,6 +201,9 @@ int device_power_add_state_wait_callback(device_power_state_e state_bits, if (!IS_STATE_BIT(state_bits)) return DEVICE_ERROR_INVALID_PARAMETER; + if (!cb) + return DEVICE_ERROR_INVALID_PARAMETER; + return register_state_signal_callback(state_bits, cb, data); } @@ -312,6 +315,9 @@ int device_power_add_transient_state_wait_callback(device_power_transient_state_ if (!IS_TRANSIENT_STATE_BIT(transient_bits)) return DEVICE_ERROR_INVALID_PARAMETER; + if (!cb) + return DEVICE_ERROR_INVALID_PARAMETER; + return register_transient_state_signal_callback(transient_bits, cb, data); }