From 49670475dc6abbf51711fc57daf22bd65d4e6f80 Mon Sep 17 00:00:00 2001 From: Charles Longeau Date: Tue, 4 Nov 2008 19:20:23 +0000 Subject: fix potential null dereference. Found by LLVM/Clang Static Analyzer. initial patch from me, rewritten by jsing@ ok jsg@ --- sys/dev/pci/if_et.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index 8330c518b8f..ef2c020da00 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.14 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_et.c,v 1.15 2008/11/04 19:20:22 chl Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -974,17 +974,15 @@ int et_init(struct ifnet *ifp) { struct et_softc *sc = ifp->if_softc; - const struct et_bsize *arr; int error, i, s; s = splnet(); et_stop(sc); - arr = ifp->if_mtu <= ETHERMTU ? et_bufsize : NULL; for (i = 0; i < ET_RX_NRING; ++i) { - sc->sc_rx_data[i].rbd_bufsize = arr[i].bufsize; - sc->sc_rx_data[i].rbd_newbuf = arr[i].newbuf; + sc->sc_rx_data[i].rbd_bufsize = et_bufsize[i].bufsize; + sc->sc_rx_data[i].rbd_newbuf = et_bufsize[i].newbuf; } error = et_init_tx_ring(sc); -- cgit v1.2.3