nkaje commented on a change in pull request #2425:
URL: https://github.com/apache/mynewt-core/pull/2425#discussion_r538603829
##########
File path: sys/log/full/src/log.c
##########
@@ -955,18 +955,17 @@ log_read_hdr(struct log *log, const void *dptr, struct
log_entry_hdr *hdr)
{
int bytes_read;
+#if MYNEWT_VAL(LOG_FLAGS_IMAGE_HASH)
+ bytes_read = log_read(log, dptr, hdr, 0, (LOG_BASE_ENTRY_HDR_SIZE +
LOG_IMG_HASHLEN));
+ if (bytes_read != (LOG_BASE_ENTRY_HDR_SIZE + LOG_IMG_HASHLEN)) {
+ return SYS_EIO;
+ }
+#else
bytes_read = log_read(log, dptr, hdr, 0, LOG_BASE_ENTRY_HDR_SIZE);
if (bytes_read != LOG_BASE_ENTRY_HDR_SIZE) {
return SYS_EIO;
}
-
- if (hdr->ue_flags & LOG_FLAGS_IMG_HASH) {
Review comment:
Thanks Vipul. The gains from this is less compared to the other change
(that does look up from the end), so I updated the PR and dropped this change.
The unit tests should be probably expanded to ensure the backward compatibility
use-cases and this change could be revisited.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]