We come into our if_start routine via ether_output(), therefore there is

no need to check-and-pullup to sizeof(struct ether_header).  Instead, we
can simply assert it.
This commit is contained in:
thorpej 2022-08-22 17:07:40 +00:00
parent c5a23dac66
commit 893f6d288d
2 changed files with 6 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ipw.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $ */
/* $NetBSD: if_ipw.c,v 1.75 2022/08/22 17:07:40 thorpej Exp $ */
/* FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp */
/*-
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.74 2021/06/16 00:21:18 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.75 2022/08/22 17:07:40 thorpej Exp $");
/*-
* Intel(R) PRO/Wireless 2100 MiniPCI driver
@ -1530,9 +1530,7 @@ ipw_start(struct ifnet *ifp)
break;
}
if (m0->m_len < sizeof (struct ether_header) &&
(m0 = m_pullup(m0, sizeof (struct ether_header))) == NULL)
continue;
KASSERT(m0->m_len >= sizeof(struct ether_header));
eh = mtod(m0, struct ether_header *);
ni = ieee80211_find_txnode(ic, eh->ether_dhost);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_iwi.c,v 1.118 2022/05/23 13:53:37 rin Exp $ */
/* $NetBSD: if_iwi.c,v 1.119 2022/08/22 17:07:40 thorpej Exp $ */
/* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */
/*-
@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.118 2022/05/23 13:53:37 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.119 2022/08/22 17:07:40 thorpej Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@ -1785,11 +1785,7 @@ iwi_start(struct ifnet *ifp)
if (m0 == NULL)
break;
if (m0->m_len < sizeof (struct ether_header) &&
(m0 = m_pullup(m0, sizeof (struct ether_header))) == NULL) {
if_statinc(ifp, if_oerrors);
continue;
}
KASSERT(m0->m_len >= sizeof(struct ether_header));
eh = mtod(m0, struct ether_header *);
ni = ieee80211_find_txnode(ic, eh->ether_dhost);