diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2022-07-21 18:58:45 +0900 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2022-08-08 05:32:13 +0900 |
commit | 05927f35499cafa5fb89bdeb855a6acaa5fbe380 (patch) | |
tree | 6b4f373ec38c71d2710b80f1e7265aa5919992a0 | |
parent | e7976a043eb67e73b885a3d5a9a8df15bfa447f7 (diff) | |
download | pass-05927f35499cafa5fb89bdeb855a6acaa5fbe380.tar.gz pass-05927f35499cafa5fb89bdeb855a6acaa5fbe380.tar.bz2 pass-05927f35499cafa5fb89bdeb855a6acaa5fbe380.zip |
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 <cw00.choi@samsung.com>
-rw-r--r-- | src/util/resource.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |