]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[xsigo] Avoid storing unused uninitialised fields in gateway address
authorMichael Brown <mcb30@ipxe.org>
Wed, 16 Feb 2022 13:22:56 +0000 (13:22 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 16 Feb 2022 13:29:53 +0000 (13:29 +0000)
As reported by Coverity, xsmp_rx_xve_modify() currently passes a
partially initialised struct ib_address_vector to xve_update_tca() and
thence to eoib_set_gateway(), which uses memcpy() to store the whole
structure including the (unused and unneeded) uninitialised fields.

Silence the Coverity warning by zeroing the whole structure.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/infiniband/xsigo.c

index 0ee753c38a1c113bd6969edc6ca3ad346b04a7a2..4f5c618d79efb0f4426da186910479f2235ce92b 100644 (file)
@@ -870,6 +870,7 @@ static int xsmp_rx_xve_modify ( struct xsigo_manager *xcm,
         * erroneously transmitted as little-endian.
         */
        mtu = ntohs ( msg->mtu );
+       memset ( &tca, 0, sizeof ( tca ) );
        tca.qpn = ntohl ( msg->tca.data );
        tca.qkey = ntohs ( msg->tca.qkey );
        tca.gid_present = 1;