kmsg: Remove unnecessary copy from creating predefined log dict 33/220133/4
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 13 Dec 2019 09:28:22 +0000 (18:28 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 17 Dec 2019 01:27:59 +0000 (10:27 +0900)
Creating predefined _COMM keywords in kmsg log dict has unnecessary
copy for task comm, to avoid build issue, in the commit b621c1cdcea7
("kmsg: Use TASK_COMM_LEN size buffer for get_task_comm()").
Remove the unnecessary string copy from creating predefined kmsg
log dict.

Change-Id: I7547487497e7f3acdab452586f97cf947fc1e6db
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
kernel/printk_kmsg.c

index ff1dedbcd3b3c8816e3fb880bdd2de0b2b6fb757..6c5f0e98f85a6765d420b6a0a50f2140488a339d 100644 (file)
@@ -874,14 +874,12 @@ 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(task_comm, current);
-       strcpy(buf + len, task_comm);
+       __get_task_comm(buf + len, KMSG_DICT_MAX_LEN - len, current);
        while (buf[len] != '\0')
                len++;
        return len;