[coreboot-gerrit] New patch to review for coreboot: 7ddb8d1 cbfs: more accurate size check for simple buffer mapping

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Tue Mar 31 22:28:35 CEST 2015


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9178

-gerrit

commit 7ddb8d129b939918d76be37061c3573012df47ca
Author: Daisuke Nojiri <dnojiri at chromium.org>
Date:   Thu Sep 18 13:47:33 2014 -0700

    cbfs: more accurate size check for simple buffer mapping
    
    currently, if the cache size is, for example, 4096 byte, mapping 4096 byte data
    fails due to the overly strict check. this change allows cbfs_simple_buffer_map
    to use all the cache space to the last byte.
    
    BUG=None
    TEST=Booted Nyan Blaze.
    BRANCH=None
    Signed-off-by: Daisuke Nojiri <dnojiri at chromium.org>
    
    Original-Change-Id: I0797b5010afd7316fdec605784e8f48e2d62c37f
    Original-Reviewed-on: https://chromium-review.googlesource.com/218883
    Original-Commit-Queue: Daisuke Nojiri <dnojiri at chromium.org>
    Original-Tested-by: Daisuke Nojiri <dnojiri at chromium.org>
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
    
    (cherry picked from commit b0b31da336fa2f87fe73f063782d6243f8262d10)
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    
    Change-Id: I15e11e574cd14484fe83c9c3674bb5c2d14422f6
---
 src/lib/cbfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 90ddc31..ebcc134 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -144,7 +144,7 @@ void *cbfs_simple_buffer_map(struct cbfs_simple_buffer *buffer,
 	      "allocated=%zd, size=%zd, last_allocate=%zd\n",
 	    offset, count, buffer->allocated, buffer->size,
 	    buffer->last_allocate);
-	if (buffer->allocated + count >= buffer->size)
+	if (buffer->allocated + count > buffer->size)
 		return CBFS_MEDIA_INVALID_MAP_ADDRESS;
 	if (media->read(media, address, offset, count) != count) {
 		ERROR("simple_buffer: fail to read %zd bytes from 0x%zx\n",



More information about the coreboot-gerrit mailing list