diff --git a/src/system/kernel/arch/x86/arch_cpu.c b/src/system/kernel/arch/x86/arch_cpu.c index ff12cda9c4..7c8a68752e 100644 --- a/src/system/kernel/arch/x86/arch_cpu.c +++ b/src/system/kernel/arch/x86/arch_cpu.c @@ -587,6 +587,10 @@ arch_cpu_user_memcpy(void *to, const void *from, size_t size, addr_t *faultHandl char *tmp = (char *)to; char *s = (char *)from; + // this check is to trick the gcc4 compiler and have it keep the error label + if (to == NULL) + goto error; + *faultHandler = (addr_t)&&error; while (size--) @@ -606,6 +610,10 @@ arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t *faultHand { int fromLength = 0; + // this check is to trick the gcc4 compiler and have it keep the error label + if (to == NULL) + goto error; + *faultHandler = (addr_t)&&error; if (size > 0) { @@ -635,6 +643,10 @@ arch_cpu_user_memset(void *s, char c, size_t count, addr_t *faultHandler) { char *xs = (char *)s; + // this check is to trick the gcc4 compiler and have it keep the error label + if (s == NULL) + goto error; + *faultHandler = (addr_t)&&error; while (count--)