summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2016-02-05 10:30:38 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2016-02-05 10:30:38 +0000
commitcfa4a11bbd6611d56cfe420867c78827d023e406 (patch)
treef990aae27a4e16325bf9e7aead1ba94f49ec2c87
parent6a1e2e745fcd2ffb1d8bf378c461792031827e36 (diff)
Silence warnings from static analyzers; found by jsg@
-rw-r--r--sys/dev/pv/xen.c6
-rw-r--r--sys/dev/pv/xenstore.c13
2 files changed, 10 insertions, 9 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c
index 5770d897ceb..be581204cc7 100644
--- a/sys/dev/pv/xen.c
+++ b/sys/dev/pv/xen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xen.c,v 1.49 2016/02/02 17:52:46 mikeb Exp $ */
+/* $OpenBSD: xen.c,v 1.50 2016/02/05 10:30:37 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -1243,8 +1243,8 @@ xen_probe_devices(struct xen_softc *sc)
{
struct xen_attach_args xa;
struct xs_transaction xst;
- struct iovec *iovp1, *iovp2;
- int i, j, error = 0, iov1_cnt, iov2_cnt;
+ struct iovec *iovp1 = NULL, *iovp2 = NULL;
+ int i, j, error = 0, iov1_cnt = 0, iov2_cnt = 0;
char path[256];
memset(&xst, 0, sizeof(xst));
diff --git a/sys/dev/pv/xenstore.c b/sys/dev/pv/xenstore.c
index c759de82c1b..a1705b2471c 100644
--- a/sys/dev/pv/xenstore.c
+++ b/sys/dev/pv/xenstore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xenstore.c,v 1.26 2016/02/04 12:50:56 mikeb Exp $ */
+/* $OpenBSD: xenstore.c,v 1.27 2016/02/05 10:30:37 mikeb Exp $ */
/*
* Copyright (c) 2015 Mike Belopuhov
@@ -878,9 +878,9 @@ xs_getprop(struct xen_softc *sc, const char *path, const char *property,
char *value, int size)
{
struct xs_transaction xst;
- struct iovec *iovp;
+ struct iovec *iovp = NULL;
char key[256];
- int error, iov_cnt, ret;
+ int error, ret, iov_cnt = 0;
if (!property)
return (-1);
@@ -901,7 +901,8 @@ xs_getprop(struct xen_softc *sc, const char *path, const char *property,
if ((error = xs_cmd(&xst, XS_READ, key, &iovp, &iov_cnt)) != 0)
return (error);
- strlcpy(value, (char *)iovp->iov_base, size);
+ if (iov_cnt > 0)
+ strlcpy(value, (char *)iovp->iov_base, size);
xs_resfree(&xst, iovp, iov_cnt);
@@ -915,7 +916,7 @@ xs_setprop(struct xen_softc *sc, const char *path, const char *property,
struct xs_transaction xst;
struct iovec iov, *iovp = &iov;
char key[256];
- int error, iov_cnt, ret;
+ int error, ret, iov_cnt = 0;
if (!property)
return (-1);
@@ -948,7 +949,7 @@ xs_kvop(void *arg, int op, char *key, char *value, size_t valuelen)
struct xen_softc *sc = arg;
struct xs_transaction xst;
struct iovec iov, *iovp = &iov;
- int error = 0, iov_cnt, cmd, i;
+ int error = 0, iov_cnt = 0, cmd, i;
switch (op) {
case PVBUS_KVWRITE: