Hello Duncan Laurie,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/em100/+/48587
to review the following change.
Change subject: trace: Handle empty and oversized packets ......................................................................
trace: Handle empty and oversized packets
Signed-off-by: Duncan Laurie dlaurie@google.com Change-Id: I24f5d5973b47652ff1357756d9a01b85c41c1682 --- M trace.c 1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/87/48587/1
diff --git a/trace.c b/trace.c index 46b52b2..933575e 100644 --- a/trace.c +++ b/trace.c @@ -193,9 +193,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++) { unsigned int j = additional_pad_bytes;