From ad81d4904ca9f710cf4d56de31eca994dc005844 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 21 Sep 2021 18:52:20 +0200 Subject: 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. --- src/kernel/arch/i386/pagedir.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/kernel/arch/i386/pagedir.c') 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; -- cgit v1.2.3