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 <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);
+ strcpy(buf + len, task_comm);
while (buf[len] != '\0')
len++;
return len;