Skip to content

Commit

Permalink
gard: Allow records with an ID of 0xffffffff
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
oohal authored and stewartsmith committed Dec 1, 2017
1 parent 4717bc7 commit aee9b02
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions external/gard/gard.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit aee9b02

Please sign in to comment.