[Skiboot] [PATCH v2 6/7] core/test: add test for nul check in nvram_format()
Oliver O'Halloran
oohall at gmail.com
Wed Aug 17 15:32:53 AEST 2016
Adds a test for nvram_check() that the ibm,skiboot nvram partition is
correctly terminated.
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
core/test/run-nvram-format.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/core/test/run-nvram-format.c b/core/test/run-nvram-format.c
index 2d0c2da56ace..b8ba69867c77 100644
--- a/core/test/run-nvram-format.c
+++ b/core/test/run-nvram-format.c
@@ -65,6 +65,12 @@ int main(void)
nvram_image[0] = 0;
assert(nvram_check(nvram_image,128*1024) != 0);
+ /* Does our NUL checking work? */
+ assert(nvram_format(nvram_image, 128 * 1024) == 0);
+ h = (struct chrp_nvram_hdr *) nvram_image;
+ memset((char *) h + sizeof(*h), 0xFF, h->len * 16 - sizeof(*h));
+ assert(nvram_check(nvram_image, 128 * 1024) != 0);
+
assert(nvram_format(nvram_image, 128*1024)==0);
/* corrupt the length of the partition */
nvram_image[2] = 0;
--
2.5.5
More information about the Skiboot
mailing list