From f0d23d912d8221639194e74a835525bc22ce37bd Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Tue, 28 May 2013 19:08:15 +0000 Subject: [PATCH] servers/pm: Fix EFAULT check for SETGROUPS The previous test would return EFAULT as soon as the group pointer was NULL, while it is sensible when the count is also 0. In that case, the SETGROUP syscall is expected to clear all the group entries as the new set is empty. Change-Id: I07b7e1d1f023a52e3035d53f7d9b42b660e039e8 --- servers/pm/getset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers/pm/getset.c b/servers/pm/getset.c index 407a5a63a..9084b4e76 100644 --- a/servers/pm/getset.c +++ b/servers/pm/getset.c @@ -141,7 +141,7 @@ int do_set() if (ngroups > NGROUPS_MAX || ngroups < 0) return(EINVAL); - if (m_in.groupsp == NULL) + if (m_in.grp_no > 0 && m_in.groupsp == NULL) return(EFAULT); r = sys_datacopy(who_e, (vir_bytes) m_in.groupsp, SELF, -- 2.44.0