>-----Original Message-----
>From: Luc Michel <[email protected]>
>Sent: Wednesday, October 18, 2023 1:14 AM
>To: [email protected]
>Cc: Michel, Luc <[email protected]>; [email protected]; Edgar E .
>Iglesias <[email protected]>; Alistair Francis <[email protected]>;
>Peter Maydell <[email protected]>; Jason Wang
><[email protected]>; Philippe Mathieu-Daudé <[email protected]>;
>Iglesias, Francisco <[email protected]>; Konrad, Frederic
><[email protected]>; Boddu, Sai Pavan
><[email protected]>
>Subject: [PATCH 11/11] hw/net/cadence_gem: enforce 32 bits variable size for
>CRC
>
>The CRC was stored in an unsigned variable in gem_receive. Change it for a
>uint32_t to ensure we have the correct variable size here.
>
>Signed-off-by: Luc Michel <[email protected]>
Reviewed-by: [email protected]
>---
> hw/net/cadence_gem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index
>21146f4242..d52530bae4 100644
>--- a/hw/net/cadence_gem.c
>+++ b/hw/net/cadence_gem.c
>@@ -1103,11 +1103,11 @@ static ssize_t gem_receive(NetClientState *nc,
>const uint8_t *buf, size_t size)
>
> /* Strip of FCS field ? (usually yes) */
> if (FIELD_EX32(s->regs[R_NWCFG], NWCFG, FCS_REMOVE)) {
> rxbuf_ptr = (void *)buf;
> } else {
>- unsigned crc_val;
>+ uint32_t crc_val;
>
> if (size > MAX_FRAME_SIZE - sizeof(crc_val)) {
> size = MAX_FRAME_SIZE - sizeof(crc_val);
> }
> bytes_to_copy = size;
>--
>2.39.2