Re: [PATCH v3 2/9] bloblist: check bloblist with specified buffer size
Hi Simon, On Tue, 26 Dec 2023 at 04:47, Simon Glass wrote: > Hi Raymond, > > On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao > 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 > > Reviewed-by: Ilias Apalodimas > > --- > > 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() ? > > Yes. I will update it. [...] Regards, Raymond
Re: [PATCH v3 2/9] bloblist: check bloblist with specified buffer size
Hi Raymond, On Fri, Dec 22, 2023 at 9:31 PM Raymond Mao 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 > Reviewed-by: Ilias Apalodimas > --- > 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
[PATCH v3 2/9] bloblist: check bloblist with specified buffer size
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 Reviewed-by: Ilias Apalodimas --- 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) 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