From f6b964d39bf14db911a358435fe26b2bc05aea6a Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 11 May 2017 23:50:17 +0000 Subject: [PATCH] protect against NULL, from PaulG --- sys/kern/kern_event.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 126f0acad4fc..7cffdb6a243b 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_event.c,v 1.90 2017/05/09 21:18:51 christos Exp $ */ +/* $NetBSD: kern_event.c,v 1.91 2017/05/11 23:50:17 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.90 2017/05/09 21:18:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.91 2017/05/11 23:50:17 christos Exp $"); #include #include @@ -1020,9 +1020,10 @@ kqueue_register(struct kqueue *kq, struct kevent *kev) KERNEL_UNLOCK_ONE(NULL); /* XXXSMP */ if (error != 0) { #ifdef DIAGNOSTIC + printf("%s: event not supported for file type" - " %d (error %d)\n", __func__, - ((file_t *)kn->kn_obj)->f_type, error); + " %d (error %d)\n", __func__, kn->kn_obj ? + ((file_t *)kn->kn_obj)->f_type : -1, error); #endif /* knote_detach() drops fdp->fd_lock */ knote_detach(kn, fdp, false);