summaryrefslogtreecommitdiff
path: root/src/kernel/arch/i386/pagedir.c
diff options
context:
space:
mode:
authordzwdz2021-09-21 18:52:20 +0200
committerdzwdz2021-09-21 18:52:20 +0200
commitad81d4904ca9f710cf4d56de31eca994dc005844 (patch)
treea738b352dac7eea1001a1f8ee6a3ff7b6cb32990 /src/kernel/arch/i386/pagedir.c
parentd9ec06192725bb6bf023120e99cbe8da33756628 (diff)
start using sparse's `-Wnon-pointer-null`
While I personally don't see a reason to use NULL instead of 0, I assume that whoever made that a sparse default knew what they were doing.
Diffstat (limited to 'src/kernel/arch/i386/pagedir.c')
-rw-r--r--src/kernel/arch/i386/pagedir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/kernel/arch/i386/pagedir.c b/src/kernel/arch/i386/pagedir.c
index 770ff4e..5dd36ec 100644
--- a/src/kernel/arch/i386/pagedir.c
+++ b/src/kernel/arch/i386/pagedir.c
@@ -138,14 +138,14 @@ void *pagedir_virt2phys(struct pagedir *dir, const void __user *virt,
* while i don't currently see a reason to set permissions
* directly on page dirs, i might see one in the future.
* leaving this as-is would be a security bug */
- if (!dir->e[pd_idx].present) return 0;
+ if (!dir->e[pd_idx].present) return NULL;
pagetable = (void*)(dir->e[pd_idx].address << 11);
page = pagetable[pt_idx];
- if (!page.present) return 0;
- if (user && !page.user) return 0;
- if (writeable && !page.writeable) return 0;
+ if (!page.present) return NULL;
+ if (user && !page.user) return NULL;
+ if (writeable && !page.writeable) return NULL;
phys = page.address << 11;
phys |= virt_cast & 0xFFF;