Module Name: src Committed By: maxv Date: Sat Nov 16 10:19:29 UTC 2019
Modified Files: src/sys/arch/x86/x86: pmap.c Log Message: Add a NULL check on the structure pointer, not to retrieve its first field if it is NULL. The previous code was not buggy strictly speaking. This change probably doesn't change anything, except removing assumptions in the compiler optimization passes, which too probably doesn't change anything in this case. Reported-by: syzbot+110b29c1973f38a38...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.340 -r1.341 src/sys/arch/x86/x86/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/x86/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.340 src/sys/arch/x86/x86/pmap.c:1.341 --- src/sys/arch/x86/x86/pmap.c:1.340 Thu Nov 14 17:09:23 2019 +++ src/sys/arch/x86/x86/pmap.c Sat Nov 16 10:19:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.340 2019/11/14 17:09:23 maxv Exp $ */ +/* $NetBSD: pmap.c,v 1.341 2019/11/16 10:19:29 maxv Exp $ */ /* * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc. @@ -130,7 +130,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.340 2019/11/14 17:09:23 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.341 2019/11/16 10:19:29 maxv Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -541,6 +541,8 @@ static inline struct pv_pte * pve_to_pvpte(struct pv_entry *pve) { + if (pve == NULL) + return NULL; KASSERT((void *)&pve->pve_pte == (void *)pve); return &pve->pve_pte; }