Fix SVACE reported bugs 45/280345/1
authorUnsung Lee <unsung.lee@samsung.com>
Mon, 29 Aug 2022 01:35:45 +0000 (10:35 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Mon, 29 Aug 2022 01:38:35 +0000 (10:38 +0900)
Change-Id: Iffde2d9dcc0b5a76f28e1ac899f673f9417bf89c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-optimizer/cpu/cpu-boosting.c

index bde8f96..2f26ca0 100644 (file)
@@ -63,7 +63,7 @@ static int cpu_boosting_get_tids(pid_t pid, resource_pid_t *resource_pid)
        int ret;
        int tid;
        DIR *dir;
-       int *tid_list = NULL;
+       pid_t *tid_list = NULL;
        int alloc_count = 0;
        int tid_count = 0;
        struct dirent *dirent;
@@ -95,7 +95,7 @@ static int cpu_boosting_get_tids(pid_t pid, resource_pid_t *resource_pid)
                if (tid > 0) {
                        if (alloc_count == tid_count) {
                                alloc_count += 15;
-                               tid_list = (int *)realloc(tid_list, alloc_count * sizeof(pid_t));
+                               tid_list = (pid_t *)realloc(tid_list, alloc_count * sizeof(pid_t));
                                if (tid_list == NULL) {
                                        _E("[CPU-BOOSTING] Failed to allocate memory");
                                        closedir(dir);
@@ -315,8 +315,7 @@ static int cpu_boosting_enqueue_by_socket(int sock, struct cpu_boosting_input **
 
        if (input->client_input.command == CPU_BOOSTING_COMMAND_CLEAR ||
                input->client_input.command == CPU_BOOSTING_COMMAND_SET) {
-               if (input->client_input.level < CPU_BOOSTING_LEVEL_NONE ||
-                       input->client_input.level > CPU_BOOSTING_LEVEL_WEAK) {
+               if (input->client_input.level > CPU_BOOSTING_LEVEL_WEAK) {
                        ret = RESOURCED_ERROR_FAIL;
                        _E("[CPU-BOOSTING] cpu boosting (level = %d) is out of scope",
                                        input->client_input.level);