Project

General

Profile

Actions

Bug #5856

closed

syscall/memctl should compare attr != 0, being an int, instead of NULL

Added by Richard PALO over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2015-04-20
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

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:
Actions #1

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.

Actions #2

Updated by Dan McDonald over 6 years ago

  • Subject changed from syscall/memctl should compare attr != 0, being an int, instead of NULL to syscall/memctl should compare attr != 0, being an int, instead of NULL
Actions #3

Updated by Electric Monk over 6 years ago

  • Status changed from New to Closed

git commit ede2438e8f556ca20640a62396a44cf0c635b8f9

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 <rm@joyent.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Actions

Also available in: Atom PDF