Creating predifined _PID, _TID, _COMM keywords kmsg log dict has
unnecessary comple for task comm. Simplify creating predefined
kmsg log dict.
This also fixes to use TASK_COMM_LEN buffer for get_task_comm().
Change-Id: I7547487497e7f3acdab452586f97cf947fc1e6db
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
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);
+ len += snprintf(buf + len, 6 + TASK_COMM_LEN, "_COMM=%s", task_comm);
while (buf[len] != '\0')
len++;
return len;