Re: [PATCH] make checkpatch warn about access to current->comm
From: KOSAKI Motohiro
Date: Tue Jan 27 2009 - 00:50:32 EST
> +# direct access to current task name is racy, suggest accessor instead.
> + if ($line =~ /current\-\>comm/) {
> + WARN("direct access to current->comm is racy, use get_task_comm() instead.\n" . $herecurr);
> + }
> +
> # use of NR_CPUS is usually wrong
> # ignore definitions of NR_CPUS and usage to define arrays as likely right
> if ($line =~ /\bNR_CPUS\b/ &&
./scripts/checkpatch --file fs/exec.c
------------------------------------------------------
WARNING: direct access to current->comm is racy, use get_task_comm() instead.
#952: FILE: exec.c:952:
+ char tcomm[sizeof(current->comm)];
(snip)
WARNING: direct access to current->comm is racy, use get_task_comm() instead.
#1459: FILE: exec.c:1459:
+ "%s", current->comm);
(snip)
WARNING: direct access to current->comm is racy, use get_task_comm() instead.
#1788: FILE: exec.c:1788:
+ if (!strcmp(delimit, current->comm)) {
---------------------------
I think "char tcomm[sizeof(current->comm)];" is valid code.
if checkpatch.pl don't warn "sizeof(current->comm)", I'm glad.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/