From 6555f01eec0729408ff6cde9124c4efd1831dd57 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Mon, 28 Nov 2016 07:04:32 +0000 Subject: [PATCH] hyperv/vmbus: Stringent GPADL parameter assertion. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8632 --- sys/dev/hyperv/vmbus/vmbus_chan.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/dev/hyperv/vmbus/vmbus_chan.c b/sys/dev/hyperv/vmbus/vmbus_chan.c index 70e12c5e09df..47333ee72aa0 100644 --- a/sys/dev/hyperv/vmbus/vmbus_chan.c +++ b/sys/dev/hyperv/vmbus/vmbus_chan.c @@ -502,11 +502,7 @@ vmbus_chan_gpadl_connect(struct vmbus_channel *chan, bus_addr_t paddr, int page_count, range_len, i, cnt, error; uint64_t page_id; - /* - * Reset GPADL, so that the result would consistent, if error - * happened later on. - */ - *gpadl0 = 0; + KASSERT(*gpadl0 == 0, ("GPADL is not zero")); /* * Preliminary checks. @@ -652,6 +648,8 @@ vmbus_chan_gpadl_disconnect(struct vmbus_channel *chan, uint32_t gpadl) struct vmbus_chanmsg_gpadl_disconn *req; int error; + KASSERT(gpadl != 0, ("GPADL is zero")); + mh = vmbus_msghc_get(sc, sizeof(*req)); if (mh == NULL) { vmbus_chan_printf(chan,