Coverity CID 1140: NULL dereference cannot happen, but protect against it.

This commit is contained in:
christos 2006-04-04 14:18:35 +00:00
parent 41a4245aa5
commit e2b3af9d2c
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdesc_vnops.c,v 1.90 2006/03/01 12:38:21 yamt Exp $ */ /* $NetBSD: fdesc_vnops.c,v 1.91 2006/04/04 14:18:35 christos Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.90 2006/03/01 12:38:21 yamt Exp $"); __KERNEL_RCSID(0, "$NetBSD: fdesc_vnops.c,v 1.91 2006/04/04 14:18:35 christos Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -786,7 +786,7 @@ fdesc_readdir(v)
default: default:
KASSERT(fdp != NULL); KASSERT(fdp != NULL);
j = (int)i - 2; j = (int)i - 2;
if (fdp->fd_ofiles[j] == NULL || if (fdp == NULL || fdp->fd_ofiles[j] == NULL ||
FILE_IS_USABLE(fdp->fd_ofiles[j]) == 0) FILE_IS_USABLE(fdp->fd_ofiles[j]) == 0)
continue; continue;
d.d_fileno = j + FD_STDIN; d.d_fileno = j + FD_STDIN;