Remove dead branches, 'npc' can't be NULL (and it is dereferenced

earlier).
This commit is contained in:
maxv 2018-03-12 12:45:26 +00:00
parent 2461f62e8b
commit 473744b505

View File

@ -1,4 +1,4 @@
/* $NetBSD: npf_alg_icmp.c,v 1.25 2017/12/10 00:07:36 rmind Exp $ */
/* $NetBSD: npf_alg_icmp.c,v 1.26 2018/03/12 12:45:26 maxv Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.25 2017/12/10 00:07:36 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: npf_alg_icmp.c,v 1.26 2018/03/12 12:45:26 maxv Exp $");
#include <sys/param.h>
#include <sys/module.h>
@ -135,9 +135,6 @@ npfa_icmp4_inspect(const int type, npf_cache_t *npc)
case ICMP_REDIRECT:
case ICMP_TIMXCEED:
case ICMP_PARAMPROB:
if (npc == NULL) {
return false;
}
/* Should contain original IP header. */
if (!nbuf_advance(nbuf, offsetof(struct icmp, icmp_ip), 0)) {
return false;
@ -175,9 +172,6 @@ npfa_icmp6_inspect(const int type, npf_cache_t *npc)
case ICMP6_PACKET_TOO_BIG:
case ICMP6_TIME_EXCEEDED:
case ICMP6_PARAM_PROB:
if (npc == NULL) {
return false;
}
/* Should contain original IP header. */
if (!nbuf_advance(nbuf, sizeof(struct icmp6_hdr), 0)) {
return false;