
Hi Raymond,
On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao raymond.mao@linaro.org wrote:
Instead of expecting the bloblist total size to be the same as the pre-allocated buffer size, practically we are more interested in whether the pre-allocated buffer size is bigger than the bloblist total size.
Signed-off-by: Raymond Mao raymond.mao@linaro.org Reviewed-by: Ilias Apalodimas ilias.apalodimas@linaro.org
Changes in v2
- New patch file created for v2.
common/bloblist.c | 2 +- test/bloblist.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/bloblist.c b/common/bloblist.c index ba17dd851a..db3fbb20cf 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -384,7 +384,7 @@ int bloblist_check(ulong addr, uint size)
Can you please also update the function comment for bloblist_check() ?
return log_msg_ret("Bad magic", -ENOENT); if (hdr->version != BLOBLIST_VERSION) return log_msg_ret("Bad version", -EPROTONOSUPPORT);
if (!hdr->total_size || (size && hdr->total_size != size))
if (!hdr->total_size || (size && hdr->total_size > size)) return log_msg_ret("Bad total size", -EFBIG); if (hdr->used_size > hdr->total_size) return log_msg_ret("Bad used size", -ENOENT);
diff --git a/test/bloblist.c b/test/bloblist.c index 17d9dd03d0..7dab9addf8 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -207,7 +207,7 @@ static int bloblist_test_checksum(struct unit_test_state *uts) hdr->flags++;
hdr->total_size--;
ut_asserteq(-EFBIG, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE));
ut_asserteq(-EIO, bloblist_check(TEST_ADDR, TEST_BLOBLIST_SIZE)); hdr->total_size++; hdr->spare++;
-- 2.25.1
Regards, Simon