From 953dd5b628d935b847ccc26d3a54603df735f26f Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Mon, 8 Aug 2016 00:14:45 +0200 Subject: [PATCH] PPP, PPPoE: remove useless checks pppoe_softc_list is always not null when pppoe_find_softc_by_session is called, furthermore pppoe_softc_list being null here does not hurt. session is still checked whatsoever in pppoe_find_softc_by_session, prechecking the session value for a value which can't really happen except for forged frames does not add any value. --- src/netif/ppp/pppoe.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index 22502e51..1530611d 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -321,10 +321,6 @@ pppoe_destroy(ppp_pcb *ppp, void *ctx) static struct pppoe_softc* pppoe_find_softc_by_session(u_int session, struct netif *rcvif) { struct pppoe_softc *sc; - if (session == 0) { - return NULL; - } - for (sc = pppoe_softc_list; sc != NULL; sc = sc->next) { if (sc->sc_state == PPPOE_STATE_SESSION && sc->sc_session == session @@ -340,10 +336,6 @@ static struct pppoe_softc* pppoe_find_softc_by_session(u_int session, struct net static struct pppoe_softc* pppoe_find_softc_by_hunique(u8_t *token, size_t len, struct netif *rcvif) { struct pppoe_softc *sc, *t; - if (pppoe_softc_list == NULL) { - return NULL; - } - if (len != sizeof sc) { return NULL; }