summaryrefslogtreecommitdiffstats
path: root/sys/crypto/cryptosoft.c
diff options
context:
space:
mode:
authorblambert <blambert@openbsd.org>2010-07-02 02:40:15 +0000
committerblambert <blambert@openbsd.org>2010-07-02 02:40:15 +0000
commit41b18b7efaec5eccb1adb3e63aeb9377f4c90ebf (patch)
tree302d91ce246e0922e434bf95ecec888dab2647f8 /sys/crypto/cryptosoft.c
parentbraces define scope, not indentation. found hunting uninit bugs. ok oga (diff)
downloadwireguard-openbsd-41b18b7efaec5eccb1adb3e63aeb9377f4c90ebf.tar.xz
wireguard-openbsd-41b18b7efaec5eccb1adb3e63aeb9377f4c90ebf.zip
m_copyback can fail to allocate memory, but is a void fucntion so gymnastics
are required to detect that. Change the function to take a wait argument (used in nfs server, but M_NOWAIT everywhere else for now) and to return an error ok claudio@ henning@ krw@
Diffstat (limited to 'sys/crypto/cryptosoft.c')
-rw-r--r--sys/crypto/cryptosoft.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c
index b5627b84ad3..b0d135714ee 100644
--- a/sys/crypto/cryptosoft.c
+++ b/sys/crypto/cryptosoft.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptosoft.c,v 1.53 2010/04/20 22:05:41 tedu Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.54 2010/07/02 02:40:15 blambert Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -81,7 +81,7 @@ u_int32_t swcr_sesnum = 0;
int32_t swcr_id = -1;
#define COPYBACK(x, a, b, c, d) \
- (x) == CRYPTO_BUF_MBUF ? m_copyback((struct mbuf *)a,b,c,d) \
+ (x) == CRYPTO_BUF_MBUF ? m_copyback((struct mbuf *)a,b,c,d,M_NOWAIT) \
: cuio_copyback((struct uio *)a,b,c,d)
#define COPYDATA(x, a, b, c, d) \
(x) == CRYPTO_BUF_MBUF ? m_copydata((struct mbuf *)a,b,c,d) \
@@ -207,7 +207,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf,
}
/* Copy back decrypted block */
- m_copyback(m, k, blks, blk);
+ m_copyback(m, k, blks, blk, M_NOWAIT);
/* Advance pointer */
m = m_getptr(m, k + blks, &k);