diff mbox series

[1/8] gard: Allow records with an ID of 0xffffffff

Message ID 20171130053129.22642-1-oohall@gmail.com
State Accepted
Headers show
Series [1/8] gard: Allow records with an ID of 0xffffffff | expand

Commit Message

Oliver O'Halloran Nov. 30, 2017, 5:31 a.m. UTC
We currently assume that a record with an ID of 0xffffffff is invalid.
Apparently this is incorrect and we should display these records, so
expand the check to compare the entire record with 0xff rather than
just the ID.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 external/gard/gard.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Stewart Smith Dec. 1, 2017, 7:22 a.m. UTC | #1
Oliver O'Halloran <oohall@gmail.com> writes:
> We currently assume that a record with an ID of 0xffffffff is invalid.
> Apparently this is incorrect and we should display these records, so
> expand the check to compare the entire record with 0xff rather than
> just the ID.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  external/gard/gard.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

series merged to master as of daf9ff43cd0a2845a06b4f6cb209eab0111e13a3
diff mbox series

Patch

diff --git a/external/gard/gard.c b/external/gard/gard.c
index a49151653aa0..c280bbf710ba 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -42,8 +42,6 @@ 
 
 #include "gard.h"
 
-#define CLEARED_RECORD_ID 0xFFFFFFFF
-
 #define FDT_PATH "/proc/device-tree"
 #define FDT_FSP_NODE FDT_PATH"/fsps"
 #define FDT_ACTIVE_FLASH_PATH FDT_PATH"/chosen/ibm,system-flash"
@@ -326,9 +324,11 @@  int parse_path(const char *str, struct entity_path *parsed)
 	return 0;
 }
 
+static struct gard_record blank_record;
+
 static bool is_valid_record(struct gard_record *g)
 {
-	return be32toh(g->record_id) != CLEARED_RECORD_ID;
+	return memcmp(&blank_record, g, sizeof(*g));
 }
 
 static int do_iterate(struct gard_ctx *ctx,
@@ -806,6 +806,7 @@  int main(int argc, char **argv)
 
 	ctx = &_ctx;
 	memset(ctx, 0, sizeof(*ctx));
+	memset(&blank_record, 0xff, sizeof(blank_record));
 
 	if (is_fsp()) {
 		fprintf(stderr, "This is the OpenPower gard tool which does "