Re: [PATCH] kernel/capability.c get_task_comm compile error (MMOTM)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>
Cc: Erez Zadok <ezk@...>, Andrew Morton <akpm@...>, <linux-kernel@...>, Ulrich Drepper <drepper@...>, Roland McGrath <roland@...>, Andrew G. Morgan <morgan@...>, Casey Schaufler <casey@...>, Chris Wright <chrisw@...>, James Morris <jmorris@...>, Serge Hallyn <serue@...>, Stephen Smalley <sds@...>
Date: Sunday, November 11, 2007 - 1:11 pm

In message <20071111141510.GA29126@elte.hu>, Ingo Molnar writes:

Ingo, I don't see how it can return NULL.  This is what get_task_comm looks
like in MMOTM-2007-11-10-19-05:

char *get_task_comm(char *buf, struct task_struct *tsk)
{
	/* buf must be at least sizeof(tsk->comm) in size */
	task_lock(tsk);
	strncpy(buf, tsk->comm, sizeof(tsk->comm));
	task_unlock(tsk);
	return buf;
}

The only way it'd return NULL is if a null buf was passed, in which case the
strncpy will oops first.

Erez.
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] kernel/capability.c get_task_comm compile error ..., Erez Zadok, (Sun Nov 11, 1:11 pm)