Fix eeprom == NULL and size test.

Fixes Coverity CID 1109: (sc)->eeprom_data tracked as NULL was
dereferenced.
This commit is contained in:
chris 2006-03-18 18:44:16 +00:00
parent a7fb3cd241
commit aee09871fa

View File

@ -1,4 +1,4 @@
/* $NetBSD: cs89x0.c,v 1.18 2005/12/11 12:21:26 christos Exp $ */
/* $NetBSD: cs89x0.c,v 1.19 2006/03/18 18:44:16 chris Exp $ */
/*
* Copyright (c) 2004 Christopher Gilbert
@ -212,7 +212,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.18 2005/12/11 12:21:26 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.19 2006/03/18 18:44:16 chris Exp $");
#include "opt_inet.h"
@ -684,7 +684,7 @@ cs_read_pktpg_from_eeprom(struct cs_softc *sc, int pktpg, u_int16_t *pValue)
int x, maxword;
/* Check that we have eeprom data */
if (sc->eeprom_data == NULL && (sc->eeprom_size > 2))
if ((sc->eeprom_data == NULL) || (sc->eeprom_size < 2))
return (CS_ERROR);
/*