Stefan Reinauer has submitted this change. ( https://review.coreboot.org/c/em100/+/48587 )
Change subject: trace: Handle empty and oversized packets ......................................................................
trace: Handle empty and oversized packets
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Signed-off-by: Duncan Laurie dlaurie@google.com Change-Id: I24f5d5973b47652ff1357756d9a01b85c41c1682 Reviewed-on: https://review.coreboot.org/c/em100/+/48587 Reviewed-by: Furquan Shaikh furquan@google.com Reviewed-by: Angel Pons th3fanbus@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M trace.c 1 file changed, 4 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved Angel Pons: Looks good to me, approved
diff --git a/trace.c b/trace.c index 7ab2f5c..2afdbad 100644 --- a/trace.c +++ b/trace.c @@ -195,9 +195,11 @@ for (report = 0; report < REPORT_BUFFER_COUNT; report++) { data = &reportdata[report][0]; count = (data[0] << 8) | data[1]; - if (count > 1022) { + if (!count) + continue; + if (count > 1023) { printf("Warning: EM100pro sends too much data.\n"); - count = 1022; + count = 1023; } for (i = 0; i < count; i++) { int address_bytes = 0;