[RFC][PATCH 2/7] Have alloc_pidmap() return actual error code

Sukadev Bhattiprolu sukadev at linux.vnet.ibm.com
Mon May 4 11:29:54 PDT 2009


Matt Helsley [matthltc at us.ibm.com] wrote:
| > @@ -159,8 +160,10 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)
| >  	map = &pid_ns->pidmap[pid/BITS_PER_PAGE];
| >  	max_scan = (pid_max + BITS_PER_PAGE - 1)/BITS_PER_PAGE - !offset;
| >  	for (i = 0; i <= max_scan; ++i) {
| > -		if (alloc_pidmap_page(map))
| > +		if (alloc_pidmap_page(map)) {
| > +			rc = -ENOMEM;
| 
| You could return -ENOMEM from alloc_pidmap_page(map) and then just:
| 
| 	rc = alloc_pidmap_page(map);
| 	if (rc)
| 		break;

Sure. alloc_pidmap_page() can only fail for one reason so I let it stay,
but we might as well return -ENOMEM.


More information about the Containers mailing list