From 24f5b2aec3aa99303d891b83d7c8bfeda94f004a Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 14 Apr 2006 22:43:12 +0000 Subject: [PATCH] Coverity CID 1127: Prevent NULL deref. --- sys/dev/raidframe/rf_raid5.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/raidframe/rf_raid5.c b/sys/dev/raidframe/rf_raid5.c index aefca978dcec..013e89029e51 100644 --- a/sys/dev/raidframe/rf_raid5.c +++ b/sys/dev/raidframe/rf_raid5.c @@ -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 -__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 @@ -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;