Thread (78 messages) 78 messages, 6 authors, 2009-08-04

Re: [RFC v17][PATCH 52/60] c/r: support semaphore sysv-ipc

From: Cyrill Gorcunov <hidden>
Date: 2009-07-22 17:25:09
Also in: linux-mm, lkml

[Oren Laadan - Wed, Jul 22, 2009 at 06:00:14AM -0400]
...
| +static struct sem *restore_sem_array(struct ckpt_ctx *ctx, int nsems)
| +{
| +	struct sem *sma;
| +	int i, ret;
| +
| +	sma = kmalloc(nsems * sizeof(*sma), GFP_KERNEL);

Forgot to

	if (!sma)
		return -ENOMEM;

right?

| +	ret = _ckpt_read_buffer(ctx, sma, nsems * sizeof(*sma));
| +	if (ret < 0)
| +		goto out;
| +
| +	/* validate sem array contents */
| +	for (i = 0; i < nsems; i++) {
| +		if (sma[i].semval < 0 || sma[i].sempid < 0) {
| +			ret = -EINVAL;
| +			break;
| +		}
| +	}
| + out:
| +	if (ret < 0) {
| +		kfree(sma);
| +		sma = ERR_PTR(ret);
| +	}
| +	return sma;
| +}
...

	-- Cyrill
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help