Stefan Reinauer submitted this change.
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(-)
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;
To view, visit change 48587. To unsubscribe, or for help writing mail filters, visit settings.