fread could return only a partial result
(eg. NVBOOT_CONFIG_TABLE_SIZE_MAX - 1 bytes),
which right now would be accepted and only
resolved by later code.

Found-by: Coverity Scan
Signed-off-by: Patrick Georgi <[email protected]>
---
 src/data_layout.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/data_layout.c b/src/data_layout.c
index db0a0f0..11a0761 100644
--- a/src/data_layout.c
+++ b/src/data_layout.c
@@ -1050,7 +1050,7 @@ int get_bct_size_from_image(build_image_context *context)
        if (!fp)
                return ENODATA;
 
-       if (!fread(buffer, 1, NVBOOT_CONFIG_TABLE_SIZE_MAX, fp)) {
+       if (fread(buffer, 1, NVBOOT_CONFIG_TABLE_SIZE_MAX, fp) != 
NVBOOT_CONFIG_TABLE_SIZE_MAX) {
                fclose(fp);
                return ENODATA;
        }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to