From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XELPl-0006yx-5c for qemu-devel@nongnu.org; Mon, 04 Aug 2014 12:47:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XELPc-00087R-4Y for qemu-devel@nongnu.org; Mon, 04 Aug 2014 12:47:13 -0400 From: Tom Musta Date: Mon, 4 Aug 2014 11:45:34 -0500 Message-Id: <1407170739-12237-8-git-send-email-tommusta@gmail.com> In-Reply-To: <1407170739-12237-1-git-send-email-tommusta@gmail.com> References: <1407170739-12237-1-git-send-email-tommusta@gmail.com> Subject: [Qemu-devel] [PATCH 07/12] linux-user: Handle NULL argument to sched_{get, set}param List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Tom Musta , riku.voipio@linaro.org, agraf@suse.de The sched_getparam and sched_setparam system calls take a pointer argument to a sched_param structure. When this pointer is null, errno should be set to EINVAL. Signed-off-by: Tom Musta diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f524a39..5f193cd 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7699,6 +7699,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, struct sched_param *target_schp; struct sched_param schp; + if (arg2 == 0) { + return -TARGET_EINVAL; + } if (!lock_user_struct(VERIFY_READ, target_schp, arg2, 1)) goto efault; schp.sched_priority = tswap32(target_schp->sched_priority); @@ -7710,6 +7713,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { struct sched_param *target_schp; struct sched_param schp; + + if (arg2 == 0) { + return -TARGET_EINVAL; + } ret = get_errno(sched_getparam(arg1, &schp)); if (!is_error(ret)) { if (!lock_user_struct(VERIFY_WRITE, target_schp, arg2, 0)) -- 1.7.1