summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/key.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2007-06-15 22:35:59 +0000
committerbz <bz@FreeBSD.org>2007-06-15 22:35:59 +0000
commit3a2d39f8a2c5a1506f00bdd70936c4bce749b9f5 (patch)
tree7f2387d4bc7ed74dca13181d01042c779c73c713 /sys/netipsec/key.c
parent3f7b9ec5f39317c1ef5a9b97f6baaba1006ae4c6 (diff)
downloadFreeBSD-src-3a2d39f8a2c5a1506f00bdd70936c4bce749b9f5.zip
FreeBSD-src-3a2d39f8a2c5a1506f00bdd70936c4bce749b9f5.tar.gz
With the current code 'src' is never NULL. Nevertheless move the check for
NULL before dereferencing the pointer. Found with: Coverity Prevent(tm) CID: 2528
Diffstat (limited to 'sys/netipsec/key.c')
-rw-r--r--sys/netipsec/key.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 0f27f87..2f0dc7e 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -7296,11 +7296,13 @@ key_setkey(struct seckey *src, u_int16_t exttype)
{
struct mbuf *m;
struct sadb_key *p;
- int len = PFKEY_ALIGN8(sizeof(struct sadb_key) + _KEYLEN(src));
+ int len;
if (src == NULL)
return NULL;
+ len = PFKEY_ALIGN8(sizeof(struct sadb_key) + _KEYLEN(src));
+
m = key_alloc_mbuf(len);
if (m == NULL)
return NULL;
OpenPOWER on IntegriCloud