Re: [patch] oom: print triggering task's cpuset and mems allowed

Andrew Morton
2008-10-28T21:42:50Z

On Tue, 28 Oct 2008 09:08:15 -0700 (PDT)
David Rientjes <rientjes@google.com> wrote:

> +#define CPUSET_NAME_LEN (128)
> +#define CPUSET_NODELIST_LEN (256)
> +static char cpuset_name[CPUSET_NAME_LEN];
> +static char cpuset_nodelist[CPUSET_NODELIST_LEN];
>
> ...
>
> + snprintf(cpuset_name, CPUSET_NAME_LEN,
> + dentry ? (const char *)dentry->d_name.name : "/");

nit: this requires that the reviewer (and the maintainer) ensure that
CPUSET_NAME_LEN=sizeof(cpuset_name). This must be done manually and
introduces risk.

Better would be:

static char cpuset_name[128];

...

snprintf(cpuset_name, sizeof(cpuset_name), ...);