syscall/memctl should compare attr != 0, being an int, instead of NULL
diff --git a/usr/src/uts/common/syscall/memcntl.c b/usr/src/uts/common/syscall/memcntl.c index 2c1027c..ae2a0cc 100644 --- a/usr/src/uts/common/syscall/memcntl.c +++ b/usr/src/uts/common/syscall/memcntl.c @@ -384,7 +384,7 @@ memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, int attr, int mask) } break; case MC_INHERIT_ZERO: - if (arg != 0 || attr != NULL || mask != 0) + if (arg != 0 || attr != 0 || mask != 0) return (set_errno(EINVAL)); break; default:
Updated by Robert Mustacchi over 6 years ago
The fundamental problem here is that at the moment NULL is defined to be 0L in the kernel, as opposed to being defined as a (void *)0. This means that the comparison is generating the right code; however, it's confusing and likely to break in the future and should just be an explicit zero. In fact, if one replaces the current NULL with zero, we in fact even end up generating the exact same code from the compiler.
Updated by Electric Monk over 6 years ago
- Status changed from New to Closed
commit ede2438e8f556ca20640a62396a44cf0c635b8f9 Author: Richard PALO <richard@NetBSD.org> Date: 2015-04-20T21:37:42.000Z 5856 syscall/memctl should compare attr != 0, being an int, instead of NULL Reviewed by: Robert Mustacchi <firstname.lastname@example.org> Approved by: Dan McDonald <email@example.com>