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:
Gaetan Perrot <gaetan.perrot@spacecubics.com>
Loading
Please sign in to comment