From: Luca Boccassi Date: Sat, 9 Dec 2023 13:04:51 +0000 (+0000) Subject: logind: use ASSERT_PTR to validate result before use X-Git-Tag: v256-rc1~1541^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2343f6b11e740f49b36b4c53e345ee26e48ba73f;p=thirdparty%2Fsystemd.git logind: use ASSERT_PTR to validate result before use handle_action_lookup() in general can return NULL, but not here as the handle is checked before, so add an assert. CID#1529415 CID#1529416 --- diff --git a/src/login/logind-action.c b/src/login/logind-action.c index b9cb9b818dc..e8951073788 100644 --- a/src/login/logind-action.c +++ b/src/login/logind-action.c @@ -169,7 +169,7 @@ HandleAction handle_action_sleep_select(HandleActionSleepMask mask) { if (!FLAGS_SET(mask, a)) continue; - if (sleep_supported(handle_action_lookup(*i)->sleep_operation) > 0) + if (sleep_supported(ASSERT_PTR(handle_action_lookup(*i))->sleep_operation) > 0) return *i; } @@ -213,7 +213,7 @@ static int handle_action_execute( inhibit_what_to_string(m->delayed_action->inhibit_what), handle_action_to_string(handle)); - inhibit_operation = handle_action_lookup(handle)->inhibit_what; + inhibit_operation = ASSERT_PTR(handle_action_lookup(handle))->inhibit_what; /* If the actual operation is inhibited, warn and fail */ if (inhibit_what_is_valid(inhibit_operation) &&