Skip to content
Commit 8434b01b authored by Gaetan Perrot's avatar Gaetan Perrot Committed by Chris Friedt
Browse files

drivers: ethernet: add check for null fragment before TX loop



In eth_cyclonev_send(), add a guard to detect if the net_pkt has no data
buffer (i.e., pkt->buffer is NULL) before starting the TX descriptor loop.

This prevents a potential null pointer dereference on frag->data in the
first iteration of the do-while loop.

The previous in-loop check for frag was redundant and misleading: it still
allowed access to frag->data even when frag could be NULL, making the code
both unnecessary and potentially unsafe.

The new check ensures frag is valid before entering the loop, covering the
rare case where net_pkt has no associated buffer.

Signed-off-by: default avatarGaetan Perrot <gaetan.perrot@spacecubics.com>
parent 447e1188
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment