diff options
author | 2002-05-08 22:04:38 +0000 | |
---|---|---|
committer | 2002-05-08 22:04:38 +0000 | |
commit | 06139ff7f4bca150d7aec7a3ad33c78ab358267c (patch) | |
tree | 17b7d840dbd3f90d14bff4299080293fcf62fe31 | |
parent | Drives can go busy after IDENTIFY. Make sure drive is not busy before issuing (diff) | |
download | wireguard-openbsd-06139ff7f4bca150d7aec7a3ad33c78ab358267c.tar.xz wireguard-openbsd-06139ff7f4bca150d7aec7a3ad33c78ab358267c.zip |
Don't deref null pointer in failure case.
-rw-r--r-- | sys/crypto/cryptodev.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/crypto/cryptodev.c b/sys/crypto/cryptodev.c index 7019e6a301a..070203f4004 100644 --- a/sys/crypto/cryptodev.c +++ b/sys/crypto/cryptodev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptodev.c,v 1.41 2002/04/27 23:13:59 deraadt Exp $ */ +/* $OpenBSD: cryptodev.c,v 1.42 2002/05/08 22:04:38 jason Exp $ */ /* * Copyright (c) 2001 Theo de Raadt @@ -476,25 +476,25 @@ cryptodev_key(struct crypt_kop *kop) case CRK_MOD_EXP: if (in == 3 && out == 1) break; - goto fail; + return (EINVAL); case CRK_MOD_EXP_CRT: if (in == 6 && out == 1) break; - goto fail; + return (EINVAL); case CRK_DSA_SIGN: if (in == 5 && out == 2) break; - goto fail; + return (EINVAL); case CRK_DSA_VERIFY: if (in == 7 && out == 0) break; - goto fail; + return (EINVAL); case CRK_DH_COMPUTE_KEY: if (in == 3 && out == 1) break; - goto fail; + return (EINVAL); default: - goto fail; + return (EINVAL); } krp = (struct cryptkop *)malloc(sizeof *krp, M_XDATA, M_WAITOK); @@ -541,8 +541,8 @@ cryptodev_key(struct crypt_kop *kop) } fail: - kop->crk_status = krp->krp_status; if (krp) { + kop->crk_status = krp->krp_status; for (i = 0; i < CRK_MAXPARAM; i++) { if (krp->krp_param[i].crp_p) FREE(krp->krp_param[i].crp_p, M_XDATA); |