From: Seung-Woo Kim Date: Tue, 17 Dec 2019 01:18:03 +0000 (+0900) Subject: kmsg: Use TASK_COMM_LEN size buffer for get_task_comm() X-Git-Tag: submit/tizen/20191219.064152~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b621c1cdcea75e6aada235b760c5abde7da73eae;p=profile%2Fmobile%2Fplatform%2Fkernel%2Flinux-3.10-sc7730.git kmsg: Use TASK_COMM_LEN size buffer for get_task_comm() To avoid gcc-8 warning, get_task_comm() is fixed to check size of buffer from the mainline commit 3756f6401c30 ("exec: avoid gcc-8 warning for get_task_comm"). To apply the commit, use TASK_COMM_LEN size buffer for get_task_comm() in set_kmsg_dict(). Afte the mainline commit is applied, newly added unnecessary copy will be removed properly. Change-Id: Ic9a55c667143d5311e1e01c4ec9b44c7f2148eae Signed-off-by: Seung-Woo Kim --- diff --git a/kernel/printk_kmsg.c b/kernel/printk_kmsg.c index 00515b82..ff1dedbc 100644 --- a/kernel/printk_kmsg.c +++ b/kernel/printk_kmsg.c @@ -874,12 +874,14 @@ void log_buf_release(struct kref *ref) static size_t set_kmsg_dict(char *buf) { size_t len; + char task_comm[TASK_COMM_LEN]; len = sprintf(buf, "_PID=%d", task_tgid_nr(current)) + 1; len += sprintf(buf + len, "_TID=%d", task_pid_nr(current)) + 1; memcpy(buf + len, "_COMM=", 6); len += 6; - get_task_comm(buf + len, current); + get_task_comm(task_comm, current); + strcpy(buf + len, task_comm); while (buf[len] != '\0') len++; return len;