From: Chanwoo Choi Date: Thu, 21 Jul 2022 09:58:45 +0000 (+0900) Subject: util: resource: Check whether interest_mask is valid or not X-Git-Tag: submit/tizen/20220809.025855~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05927f35499cafa5fb89bdeb855a6acaa5fbe380;p=platform%2Fcore%2Fsystem%2Fpass.git util: resource: Check whether interest_mask is valid or not unset_resource_attr_interest function is able to unset the resource interest state when resource interest were already interested. If wrong interest_mask is used, should return fail. So that Check whether interest_mask is valid or not before unsetting resource attribute interest. Change-Id: I047a30ab1fa5c0cafd23327a7fbfabc9c3c9b274 Signed-off-by: Chanwoo Choi --- diff --git a/src/util/resource.c b/src/util/resource.c index 52cb8c1..b71e67f 100644 --- a/src/util/resource.c +++ b/src/util/resource.c @@ -1009,6 +1009,9 @@ int unset_resource_attr_interest(struct resource *resource, u_int64_t interest_m if (!resource) return -EINVAL; + if (!is_resource_attr_interested(resource, interest_mask)) + return -EINVAL; + for (i = 0; i < resource->num_attrs; i++) { if (!(resource->attrs[i].id & interest_mask)) continue;