Example #1
0
static int __wind_task_nametoid(struct task_struct *curr, struct pt_regs *regs)
{
	char name[XNOBJECT_NAME_LEN];
	WIND_TCB_PLACEHOLDER ph;
	xnhandle_t handle;

	if (!__xn_access_ok
	    (curr, VERIFY_WRITE, __xn_reg_arg2(regs), sizeof(ph)))
		return -EFAULT;

	if (!__xn_reg_arg1(regs))
		return S_taskLib_NAME_NOT_FOUND;

	if (!__xn_access_ok
	    (curr, VERIFY_READ, __xn_reg_arg1(regs), sizeof(name)))
		return -EFAULT;

	__xn_strncpy_from_user(curr, name,
			       (const char __user *)__xn_reg_arg1(regs),
			       sizeof(name) - 1);
	name[sizeof(name) - 1] = '\0';

	handle = taskNameToHandle(name);
	if (handle == XN_NO_HANDLE)
		return wind_errnoget();

	ph.handle = handle; /* Copy back the task handle. */

	__xn_copy_to_user(curr, (void __user *)__xn_reg_arg2(regs), &ph,
			  sizeof(ph));

	return 0;
}
Example #2
0
static int __wind_task_nametoid(struct pt_regs *regs)
{
	char name[XNOBJECT_NAME_LEN];
	WIND_TCB_PLACEHOLDER ph;
	xnhandle_t handle;

	if (!__xn_reg_arg1(regs))
		return S_taskLib_NAME_NOT_FOUND;

	if (__xn_safe_strncpy_from_user(name,
					(const char __user *)__xn_reg_arg1(regs),
					sizeof(name) - 1) < 0)
		return -EFAULT;

	name[sizeof(name) - 1] = '\0';

	handle = taskNameToHandle(name);
	if (handle == XN_NO_HANDLE)
		return wind_errnoget();

	ph.handle = handle; /* Copy back the task handle. */

	return __xn_safe_copy_to_user((void __user *)__xn_reg_arg2(regs), &ph, sizeof(ph));
}