Re: [PATCH] cpuset : Handling improper memory allocation.

From: Max Krasnyansky
Date: Wed Aug 06 2008 - 16:44:24 EST


Paul Jackson wrote:
Max wrote:
partition_sched_domains() can deal with attrs==NULL case. So we do not
have to abort domain building.

This might be a good place for a comment, since unchecked kmalloc()
calls look dangerous:

/* Convert <csn, csa> to <ndoms, doms> */
doms = kmalloc(ndoms * sizeof(cpumask_t), GFP_KERNEL);
if (!doms)
goto rebuild;
dattr = kmalloc(ndoms * sizeof(struct sched_domain_attr), GFP_KERNEL);
/* dattr == NULL is ok; partition_sched_domains() can cope with it. */

Makes sense. I'll add it, since I'm touching that area anyway.

Max


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