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

From: Andrew Morton
Date: Tue Oct 28 2008 - 17:42:51 EST


On Tue, 28 Oct 2008 09:08:15 -0700 (PDT)
David Rientjes <rientjes@xxxxxxxxxx> 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), ...);

--
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/