make McKernel's execve behave same as Linux when argv or envp is set to NULL (fix for TEMP_FIX_21)

This commit is contained in:
Ken Sato
2017-12-26 17:43:17 +09:00
parent d209c00a30
commit 6084faeecd
2 changed files with 17 additions and 7 deletions

View File

@@ -280,6 +280,18 @@ int flatten_strings_from_user(int nr_strings, char *first, char **strings, char
long r;
int n, ret;
/* When strings is NULL, make array one NULL */
if (!strings) {
full_len = sizeof(long) + sizeof(char *);
_flat = kmalloc(full_len, IHK_MC_AP_NOWAIT);
if (!_flat) {
return -ENOMEM;
}
memset(_flat, 0, full_len);
*flat = (char *)_flat;
return full_len;
}
/* How many strings do we have? */
if (nr_strings == -1) {
nr_strings = 0;