Peter Marheine submitted this change.
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
Add clarification to struct flash_region on chipoff_t
Although chipoff_t is fairly clearly documented on its own, it seems
fairly frequent that developers will treat the end address of a flash
region as an exclusive upper bound rather than the inclusive one it
should be; for example CB:82496 fixes an incorrect use that affected
multiple sites, and CB:73571 stemmed from a similar cause. Add a
clarifying comment to call attention to this, to help programmers avoid
making similar mistakes in the future.
Change-Id: I80b61a87ca31bd5a116224aadb4e211ee6841e1f
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/82677
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M include/layout.h
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/layout.h b/include/layout.h
index 5614bea..d03a15b 100644
--- a/include/layout.h
+++ b/include/layout.h
@@ -37,6 +37,11 @@
struct flash_region {
char *name;
+ /*
+ * Note that because start and end are chipoff_t, end is an inclusive upper
+ * bound: the length of a region is (end - start + 1) bytes and it is
+ * impossible to represent a region with zero length.
+ */
chipoff_t start;
chipoff_t end;
bool read_prot;
To view, visit change 82677. To unsubscribe, or for help writing mail filters, visit settings.