Fixed svace issues
authorsaerome kim <saerome.kim@samsung.com>
Thu, 7 Feb 2019 09:09:17 +0000 (18:09 +0900)
committer김새롬/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <saerome.kim@samsung.com>
Thu, 7 Feb 2019 22:52:52 +0000 (07:52 +0900)
Signed-off-by: saerome kim <saerome.kim@samsung.com>
ua-daemon/src/pm/ua-plugin-manager.c
ua-daemon/src/ua-manager-core.c
ua-daemon/src/ua-manager-request-handler.c

index 9fa98e2..01215ca 100644 (file)
@@ -115,7 +115,7 @@ static int __load_plugin(const char *path, const char *name, const char *symbol)
        handle = dlopen(filename, RTLD_NOW);
        g_free(filename);
        if (handle == NULL) {
-               UAM_ERR("Can't load plugin %s: %s", filename, dlerror());
+               UAM_ERR("Can't load plugin%s", dlerror());
                return UAM_ERROR_INTERNAL;
        }
 
@@ -375,7 +375,7 @@ gboolean _uam_pm_is_sensor_ready(unsigned int sensor_bitmask)
        uam_sensor_plugin_info_t *plugin;
 
        id = _pm_util_sensor_bitmask_to_plugin_id(sensor_bitmask);
-       retv_if(UAS_PLUGIN_ID_MAX < id, FALSE);
+       retv_if(UAS_PLUGIN_ID_MAX <= id, FALSE);
 
        plugin = plugins[id];
        retv_if(!plugin || !plugin->api, FALSE);
index bbac9b2..c51e468 100644 (file)
@@ -194,7 +194,7 @@ static void __remove_user_device(gpointer data)
                for (l1 = tech->addresses; NULL != l1; l1 = g_slist_next(l1)) {
                        uam_db_address_info_t *addr = l1->data;
 
-                       if (!l1)
+                       if (!addr)
                                continue;
 
                        switch (addr->addr_type) {
@@ -604,7 +604,7 @@ int _uam_core_add_user(const char *account, const char *name)
 
        user = g_new0(uam_db_user_info_t, 1);
        user->user_id = __uam_core_reserve_user_id();
-       if (0 > user->user_id) {
+       if (USHRT_MAX - 1 < user->user_id) {
                UAM_ERR("Max user limit reached");
                g_free(user);
                return UAM_ERROR_INTERNAL;
@@ -1624,7 +1624,12 @@ void _uam_core_handle_device_added(int status,
                                }
                        }
                        l = g_slist_find_custom(users, USER_ACCOUNT_DEFAULT, __compare_user_account);
-                       user = l->data;
+                       if (l)
+                               user = l->data;
+                       else {
+                               UAM_ERR("_uam_core_add_user failed because user is null");
+                               return;
+                       }
                } else {
                        l = g_slist_find_custom(users, &user_id, __compare_user_id);
                        if (NULL == l) {
index 7e293b7..928f197 100644 (file)
@@ -762,7 +762,7 @@ void _uam_manager_remove_req_ctxt_from_list(uam_request_context_t *req_info)
        ret_if(NULL == req_info);
        ret_if(NULL == req_info->sender);
 
-       for (l = request_list; l != NULL; l = g_slist_next(l)) {
+       for (l = request_list; NULL != l; l = g_slist_next(l)) {
                uam_request_context_t *info = l->data;
                if (NULL == info || NULL == info->sender)
                        continue;