[PATCH RFC 2/6] purgatory: No need to sha256 update if ptr->len is zero
Pratyush Anand
panand at redhat.com
Thu Apr 16 09:47:25 PDT 2015
If ptr->len is zero we do not need to update sha256.
Signed-off-by: Pratyush Anand <panand at redhat.com>
---
purgatory/purgatory.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/purgatory/purgatory.c b/purgatory/purgatory.c
index 3bbcc0935ad5..f8ed69b8fbfb 100644
--- a/purgatory/purgatory.c
+++ b/purgatory/purgatory.c
@@ -18,6 +18,8 @@ int verify_sha256_digest(void)
sha256_starts(&ctx);
end = &sha256_regions[sizeof(sha256_regions)/sizeof(sha256_regions[0])];
for(ptr = sha256_regions; ptr < end; ptr++) {
+ if (ptr->len == 0)
+ continue;
sha256_update(&ctx, (uint8_t *)((uintptr_t)ptr->start),
ptr->len);
}
--
2.1.0
More information about the kexec
mailing list