diff options
author | bz <bz@FreeBSD.org> | 2007-06-15 23:45:39 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2007-06-15 23:45:39 +0000 |
commit | e622d327e5f02efe846738ac48071275cdd3a234 (patch) | |
tree | 7f8a5e78c0a7cb6c3097e9e443704822d42c0e42 /sys/netipsec/key.c | |
parent | 7d427641bffb8a59a5be2e9fe2eb297d89427dbb (diff) | |
download | FreeBSD-src-e622d327e5f02efe846738ac48071275cdd3a234.zip FreeBSD-src-e622d327e5f02efe846738ac48071275cdd3a234.tar.gz |
Add a missing return so that we drop out in case of an error and
do not continue with a NULL pointer. [1]
While here change the return of the error handling code path above.
I cannot see why we should always return 0 there. Neither does KAME
nor do we in here for the similar check in all the other functions.
Found with: Coverity Prevent(tm) [1]
CID: 2521
Diffstat (limited to 'sys/netipsec/key.c')
-rw-r--r-- | sys/netipsec/key.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 2f0dc7e..daf539a 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -2123,8 +2123,7 @@ key_spddelete2(so, m, mhp) if (mhp->ext[SADB_X_EXT_POLICY] == NULL || mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) { ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__)); - key_senderror(so, m, EINVAL); - return 0; + return key_senderror(so, m, EINVAL); } id = ((struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY])->sadb_x_policy_id; @@ -2132,7 +2131,7 @@ key_spddelete2(so, m, mhp) /* Is there SP in SPD ? */ if ((sp = key_getspbyid(id)) == NULL) { ipseclog((LOG_DEBUG, "%s: no SP found id:%u.\n", __func__, id)); - key_senderror(so, m, EINVAL); + return key_senderror(so, m, EINVAL); } sp->state = IPSEC_SPSTATE_DEAD; |