From: Hwankyu Jhun Date: Mon, 5 Oct 2020 05:37:44 +0000 (+0900) Subject: Initialize variables X-Git-Tag: submit/tizen/20201005.080324~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4549f2ffe29602becc57177b0f48fb449c5087dd;p=platform%2Fcore%2Fappfw%2Famd.git Initialize variables This patch removes using uninitialised bytes. Change-Id: Ic147bad418888f62ecd31ed6d4c28cbc476f1032 Signed-off-by: Hwankyu Jhun --- diff --git a/src/lib/amd_launch.c b/src/lib/amd_launch.c index 7879341b..8a9101dc 100644 --- a/src/lib/amd_launch.c +++ b/src/lib/amd_launch.c @@ -368,13 +368,11 @@ static int __send_sigkill(int pid, uid_t uid) int _resume_app(int pid, request_h req) { - int dummy; int ret; uid_t target_uid = _request_get_target_uid(req); - ret = aul_sock_send_raw(pid, target_uid, - APP_RESUME_BY_PID, (unsigned char *)&dummy, 0, - AUL_SOCK_ASYNC); + ret = aul_sock_send_raw(pid, target_uid, APP_RESUME_BY_PID, + NULL, 0, AUL_SOCK_ASYNC); if (ret < 0) { if (ret == -EAGAIN) { _E("resume packet timeout error"); @@ -423,13 +421,11 @@ int _launch_resume_inst(int pid, request_h req) int _pause_app(int pid, request_h req) { - int dummy; int ret; uid_t target_uid = _request_get_target_uid(req); - ret = aul_sock_send_raw(pid, target_uid, - APP_PAUSE_BY_PID, (unsigned char *)&dummy, 0, - AUL_SOCK_ASYNC); + ret = aul_sock_send_raw(pid, target_uid, APP_PAUSE_BY_PID, + NULL, 0, AUL_SOCK_ASYNC); if (ret < 0) { if (ret == -EAGAIN) { _E("pause packet timeout error"); @@ -478,11 +474,10 @@ int _launch_pause_inst(int pid, request_h req) int _term_sub_app(int pid, uid_t uid) { - int dummy; int ret; ret = aul_sock_send_raw(pid, uid, APP_TERM_BY_PID_ASYNC, - (unsigned char *)&dummy, 0, AUL_SOCK_NOREPLY); + NULL, 0, AUL_SOCK_NOREPLY); if (ret < 0) { _E("terminate packet send error - use SIGKILL pid(%d)", pid); if (__send_sigkill(pid, uid) < 0) { @@ -523,13 +518,12 @@ int _term_sub_inst(pid_t pid, const char *inst_id, uid_t uid) int _term_app(int pid, request_h req) { - int dummy; int ret; uid_t uid = _request_get_target_uid(req); _noti_send(AMD_NOTI_MSG_LAUNCH_TERM_APP_START, pid, 0, req, NULL); ret = aul_sock_send_raw(pid, uid, APP_TERM_BY_PID, - (unsigned char *)&dummy, 0, AUL_SOCK_ASYNC); + NULL, 0, AUL_SOCK_ASYNC); if (ret < 0) { _E("terminate packet send error - use SIGKILL pid(%d)", pid); if (__send_sigkill(pid, uid) < 0) { @@ -576,12 +570,10 @@ int _launch_terminate_inst(int pid, request_h req) int _term_req_app(int pid, request_h req) { - int dummy; int ret; ret = aul_sock_send_raw(pid, _request_get_target_uid(req), - APP_TERM_REQ_BY_PID, (unsigned char *)&dummy, 0, - AUL_SOCK_ASYNC); + APP_TERM_REQ_BY_PID, NULL, 0, AUL_SOCK_ASYNC); if (ret < 0) { _D("terminate req send error"); _request_send_result(req, ret); @@ -595,13 +587,12 @@ int _term_req_app(int pid, request_h req) int _term_bgapp(int pid, request_h req) { - int dummy; int ret; uid_t uid = _request_get_target_uid(req); _noti_send(AMD_NOTI_MSG_LAUNCH_TERM_BGAPP_START, pid, 0, req, NULL); ret = aul_sock_send_raw(pid, uid, APP_TERM_BGAPP_BY_PID, - (unsigned char *)&dummy, sizeof(int), AUL_SOCK_ASYNC); + NULL, 0, AUL_SOCK_ASYNC); if (ret < 0) { _E("terminate packet send error - use SIGKILL pid(%d)", pid); if (__send_sigkill(pid, uid) < 0) { @@ -642,14 +633,12 @@ int _launch_terminate_bg_inst(int pid, request_h req) int _term_app_v2(int pid, request_h req, bool *pend) { - int dummy; int ret; uid_t uid = _request_get_target_uid(req); _noti_send(AMD_NOTI_MSG_LAUNCH_TERM_APP_START, pid, 0, req, NULL); ret = aul_sock_send_raw(pid, uid, APP_TERM_BY_PID_SYNC, - (unsigned char *)&dummy, 0, - AUL_SOCK_ASYNC | AUL_SOCK_NOREPLY); + NULL, 0, AUL_SOCK_ASYNC | AUL_SOCK_NOREPLY); if (ret < 0) { _E("Failed to send the terminate packet - use SIGKILL pid(%d)", pid); @@ -1013,20 +1002,14 @@ static int __compare_signature(const struct appinfo *ai, int cmd, static void __prepare_to_suspend(int pid, uid_t uid) { - int dummy = 0; - SECURE_LOGD("[__SUSPEND__] pid: %d, uid: %d", pid, uid); - aul_sock_send_raw(pid, uid, APP_SUSPEND, (unsigned char *)&dummy, - sizeof(int), AUL_SOCK_NOREPLY); + aul_sock_send_raw(pid, uid, APP_SUSPEND, NULL, 0, AUL_SOCK_NOREPLY); } static void __prepare_to_wake_services(int pid, uid_t uid) { - int dummy = 0; - SECURE_LOGD("[__SUSPEND__] pid: %d, uid: %d", pid, uid); - aul_sock_send_raw(pid, uid, APP_WAKE, (unsigned char *)&dummy, - sizeof(int), AUL_SOCK_NOREPLY); + aul_sock_send_raw(pid, uid, APP_WAKE, NULL, 0, AUL_SOCK_NOREPLY); } static gboolean __check_service_only(gpointer user_data) diff --git a/src/lib/amd_util.c b/src/lib/amd_util.c index 6d36ec1a..434ae63d 100644 --- a/src/lib/amd_util.c +++ b/src/lib/amd_util.c @@ -114,7 +114,7 @@ static int __send_message(int sock, const struct iovec *vec, int vec_size, static int __dispatch_get_mp_socket_pair(request_h req) { int handles[2] = {0, 0}; - struct iovec vec[3]; + struct iovec vec[3] = { 0, }; int msglen = 0; char buffer[1024]; int ret = 0; @@ -133,7 +133,7 @@ static int __dispatch_get_mp_socket_pair(request_h req) _D("amd send mp fd : [%d, %d]", handles[0], handles[1]); vec[0].iov_base = buffer; - vec[0].iov_len = strlen(buffer) + 1; + vec[0].iov_len = 1; msglen = __send_message(_request_get_fd(req), vec, 1, handles, 2); if (msglen < 0) { @@ -182,7 +182,7 @@ static int __dispatch_get_dc_socket_pair(request_h req) char *socket_pair_key = NULL; int socket_pair_key_len; int *handles = NULL; - struct iovec vec[3]; + struct iovec vec[3] = { 0, }; int msglen = 0; char buffer[1024]; bundle *kb = _request_get_bundle(req);