git: b086426bc210 - main - hyperv: Fix Coverity issues in the Hyper-V driver
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 16 Feb 2023 02:23:07 UTC
The branch main has been updated by dab: URL: https://cgit.FreeBSD.org/src/commit/?id=b086426bc210ea567422b7bedaa637f345ad2d7d commit b086426bc210ea567422b7bedaa637f345ad2d7d Author: Robert Herndon <Robert.Herndon@Dell.com> AuthorDate: 2023-02-12 05:09:20 +0000 Commit: David Bright <dab@FreeBSD.org> CommitDate: 2023-02-16 00:24:45 +0000 hyperv: Fix Coverity issues in the Hyper-V driver Summary: Coverity reports the use of two uninitialized variables in the hyperv driver. Examination shows the variables can be accessed while uninitialized in error cases. Fix both. CID: 1365235 CID: 1365236 Sponsored by: Dell Technologies MFC after: 1w Test Plan: Changes in use at $WORK Reviewers: robert.herndon_dell.com, vangyzen, bret_ketchum_dell.com Subscribers: imp, badger Differential Revision: https://reviews.freebsd.org/D38551 --- sys/dev/hyperv/utilities/vmbus_ic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/hyperv/utilities/vmbus_ic.c b/sys/dev/hyperv/utilities/vmbus_ic.c index 574670053918..f21a0242a44d 100644 --- a/sys/dev/hyperv/utilities/vmbus_ic.c +++ b/sys/dev/hyperv/utilities/vmbus_ic.c @@ -59,6 +59,9 @@ vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0, uint32_t sel_fw_ver, sel_msg_ver; bool has_fw_ver, has_msg_ver; + has_fw_ver = false; + has_msg_ver = false; + /* * Preliminary message verification. */ @@ -92,7 +95,6 @@ vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0, /* * Find the best match framework version. */ - has_fw_ver = false; for (i = 0; i < nego->ic_fwver_cnt; ++i) { if (VMBUS_ICVER_LE(nego->ic_ver[i], fw_ver)) { if (!has_fw_ver) { @@ -111,9 +113,8 @@ vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0, } /* - * Fine the best match message version. + * Find the best match message version. */ - has_msg_ver = false; for (i = nego->ic_fwver_cnt; i < nego->ic_fwver_cnt + nego->ic_msgver_cnt; ++i) { if (VMBUS_ICVER_LE(nego->ic_ver[i], msg_ver)) {