summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchl <chl@openbsd.org>2009-06-09 23:17:35 +0000
committerchl <chl@openbsd.org>2009-06-09 23:17:35 +0000
commit4c8cef37bd0f69c4749983baded46d29db84fed4 (patch)
treedd414130b873b9f897590c369f14bebbdbc3aa10
parentdocument KERN_BUFCACHEPERCENT and KERN_MAXLOCKSPERUID; help/ok oga (diff)
downloadwireguard-openbsd-4c8cef37bd0f69c4749983baded46d29db84fed4.tar.xz
wireguard-openbsd-4c8cef37bd0f69c4749983baded46d29db84fed4.zip
fix potential null dereference.
Found by LLVM/Clang Static Analyzer. ok marco@
-rw-r--r--sys/dev/softraid_crypto.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index c5c407c67ff..71f4288ff10 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.36 2009/06/03 17:39:27 ckuethe Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.37 2009/06/09 23:17:35 chl Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org>
@@ -185,8 +185,9 @@ sr_crypto_getcryptop(struct sr_workunit *wu, int encrypt)
unwind:
if (crp)
crypto_freereq(crp);
- if (wu->swu_xs->flags & SCSI_DATA_OUT)
- free(uio->uio_iov->iov_base, M_DEVBUF);
+ if (uio && uio->uio_iov)
+ if (wu->swu_xs->flags & SCSI_DATA_OUT)
+ free(uio->uio_iov->iov_base, M_DEVBUF);
s = splbio();
if (uio && uio->uio_iov)