diff options
author | Mary Ruthven <mruthven@chromium.org> | 2021-04-16 04:48:28 +1000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-19 21:52:36 +0000 |
commit | d4cb504dc0e329d2f9714a47f295c7ed8b76b527 (patch) | |
tree | 62ba7bd2ceeefc8e62b2d5a6dc5f765d3e4098b0 | |
parent | 47890947e7d51f4874e8f682ce812fb0faf4d41c (diff) | |
download | chrome-ec-factory-13929.B-cr50_stab.tar.gz |
i2cp: fix read chunk processingfactory-13929.B-cr50_stab
BUG=b:184965542
TEST=see BUG
Change-Id: I340af997123ad0b5329a81311663ed90ffaab4b3
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2836190
Reviewed-by: Andrey Pronin <apronin@chromium.org>
-rw-r--r-- | chip/g/i2cp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chip/g/i2cp.c b/chip/g/i2cp.c index ce98140289..19257be813 100644 --- a/chip/g/i2cp.c +++ b/chip/g/i2cp.c @@ -378,7 +378,9 @@ void i2cp_post_read_fill_fifo(uint8_t *buffer, size_t len) REGISTER_FILE_MASK; /* Insert bytes until fifo is word aligned */ - if (remainder_bytes) { + if (remainder_bytes && len) { + if (len < remainder_bytes) + remainder_bytes = len; /* mask the bytes to be kept */ word_out_value = value_addr[addr_offset]; word_out_value &= (1 << (8 * start_offset)) - 1; |