net: ldpaa_eth: Fix buffer overflow in memset
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 5 Aug 2025 10:52:00 +0000 (11:52 +0100)
committerJerome Forissier <jerome.forissier@linaro.org>
Mon, 18 Aug 2025 13:47:57 +0000 (15:47 +0200)
In ldpaa_eth_open a memset is used to initialise a struct to 0 but the
size passed is that of a different struct. Correct to pass the sizeof
the struct that is being initialised.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/net/ldpaa_eth/ldpaa_eth.c

index b72198c..94e6274 100644 (file)
@@ -458,7 +458,7 @@ static int ldpaa_eth_open(struct udevice *dev)
        link_state.up == 1 ? printf("up\n") : printf("error state\n");
 #endif
 
-       memset(&d_queue, 0, sizeof(struct dpni_queue));
+       memset(&d_queue, 0, sizeof(struct dpni_queue_id));
        err = dpni_get_queue(dflt_mc_io, MC_CMD_NO_FLAGS,
                             dflt_dpni->dpni_handle, DPNI_QUEUE_RX,
                             0, 0, &d_queue_cfg, &d_queue);