Coverity CID 1127: Prevent NULL deref.

This commit is contained in:
christos 2006-04-14 22:43:12 +00:00
parent 4d098765d0
commit 24f5b2aec3
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_raid5.c,v 1.16 2005/12/11 12:23:37 christos Exp $ */
/* $NetBSD: rf_raid5.c,v 1.17 2006/04/14 22:43:12 christos Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@ -33,7 +33,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_raid5.c,v 1.16 2005/12/11 12:23:37 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: rf_raid5.c,v 1.17 2006/04/14 22:43:12 christos Exp $");
#include <dev/raidframe/raidframevar.h>
@ -293,7 +293,7 @@ rf_RaidFiveDagSelect(RF_Raid_t *raidPtr, RF_IoType_t type,
if (asmap->numParityFailed == 1)
*createFunc = (RF_VoidFuncPtr) rf_CreateNonRedundantWriteDAG;
else
if (asmap->numStripeUnitsAccessed != 1 && failedPDA->numSector != layoutPtr->sectorsPerStripeUnit)
if (asmap->numStripeUnitsAccessed != 1 && (failedPDA == NULL || failedPDA->numSector != layoutPtr->sectorsPerStripeUnit))
*createFunc = NULL;
else
*createFunc = (RF_VoidFuncPtr) rf_CreateDegradedWriteDAG;