Currently, we initialize "error" to zero when it's declared, then
we never initialize it to anything else. However, in the case that m_uiotombuf fails, we return error (effectively reporting success). This appears to be a relic of an older revision of this file, where "error" used to be doing something useful. (See revision 1.1, where error is used in a loop with uiomove() instead of using m_uiotomubf). So instead on unconditionally reporting success in the case there is a failure in m_uiotombuf, explicitly return ENOBUFS. While we are here, garbage collect the error variable since it's no longer required. MFC after: 2 weeks
This commit is contained in:
parent
7d77b4e35f
commit
ca30d69fda
@ -812,7 +812,6 @@ tapwrite(struct cdev *dev, struct uio *uio, int flag)
|
||||
struct tap_softc *tp = dev->si_drv1;
|
||||
struct ifnet *ifp = tp->tap_ifp;
|
||||
struct mbuf *m;
|
||||
int error = 0;
|
||||
|
||||
TAPDEBUG("%s writting, minor = %#x\n",
|
||||
ifp->if_xname, minor(dev));
|
||||
@ -830,7 +829,7 @@ tapwrite(struct cdev *dev, struct uio *uio, int flag)
|
||||
if ((m = m_uiotombuf(uio, M_DONTWAIT, 0, ETHER_ALIGN,
|
||||
M_PKTHDR)) == NULL) {
|
||||
ifp->if_ierrors ++;
|
||||
return (error);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
|
||||
m->m_pkthdr.rcvif = ifp;
|
||||
|
Loading…
Reference in New Issue
Block a user