Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/arch/i386 x86_alldisks can be NULL, so don'...



details:   https://anonhg.NetBSD.org/src/rev/6f4e592a99b8
branches:  trunk
changeset: 816594:6f4e592a99b8
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Jul 13 15:59:54 2016 +0000

description:
x86_alldisks can be NULL, so don't dereference it. Not tested, but obvious
enough.

diffstat:

 sys/compat/linux/arch/i386/linux_machdep.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r e16e5fd463cb -r 6f4e592a99b8 sys/compat/linux/arch/i386/linux_machdep.c
--- a/sys/compat/linux/arch/i386/linux_machdep.c        Wed Jul 13 15:58:37 2016 +0000
+++ b/sys/compat/linux/arch/i386/linux_machdep.c        Wed Jul 13 15:59:54 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.161 2015/12/08 21:27:50 christos Exp $     */
+/*     $NetBSD: linux_machdep.c,v 1.162 2016/07/13 15:59:54 maxv Exp $ */
 
 /*-
  * Copyright (c) 1995, 2000, 2008, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.161 2015/12/08 21:27:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.162 2016/07/13 15:59:54 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vm86.h"
@@ -107,8 +107,9 @@
 #define DPRINTF(a)
 #endif
 
+extern struct disklist *x86_alldisks;
+
 static struct biosdisk_info *fd2biosinfo(struct proc *, struct file *);
-extern struct disklist *x86_alldisks;
 static void linux_save_ucontext(struct lwp *, struct trapframe *,
     const sigset_t *, struct sigaltstack *, struct linux_ucontext *);
 static void linux_save_sigcontext(struct lwp *, struct trapframe *,
@@ -761,6 +762,8 @@
        struct nativedisk_info *nip;
        struct disklist *dl = x86_alldisks;
 
+       if (dl == NULL)
+               return NULL;
        if (fp->f_type != DTYPE_VNODE)
                return NULL;
        vp = (struct vnode *)fp->f_data;



Home | Main Index | Thread Index | Old Index