We have uuid_equal() and uuid_is_null(), use that rather than open coded memcmp(). Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- commands/fiptool.c | 10 ++++------ lib/fip.c | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/commands/fiptool.c b/commands/fiptool.c index 45d534e470..b917c62a97 100644 --- a/commands/fiptool.c +++ b/commands/fiptool.c @@ -219,8 +219,7 @@ static __maybe_unused int create_cmd(struct fip_state *fip, int argc, char *argv parse_blob_opt(optarg, &uuid, filename, sizeof(filename)); - if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0 || - filename[0] == '\0') + if (uuid_is_null(&uuid) || filename[0] == '\0') return COMMAND_ERROR_USAGE; desc = lookup_image_desc_from_uuid(fip, &uuid); @@ -286,7 +285,7 @@ static __maybe_unused int update_cmd(struct fip_state *fip, int argc, char *argv parse_blob_opt(optarg, &uuid, filename, sizeof(filename)); - if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0 || + if (uuid_is_null(&uuid) || filename[0] == '\0') return COMMAND_ERROR_USAGE; @@ -368,8 +367,7 @@ static int unpack_cmd(struct fip_state *fip, int argc, char *argv[]) parse_blob_opt(optarg, &uuid, filename, sizeof(filename)); - if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0 || - filename[0] == '\0') + if (uuid_is_null(&uuid) || filename[0] == '\0') return COMMAND_ERROR_USAGE; desc = lookup_image_desc_from_uuid(fip, &uuid); @@ -478,7 +476,7 @@ static __maybe_unused int remove_cmd(struct fip_state *fip, int argc, char *argv parse_blob_opt(optarg, &uuid, filename, sizeof(filename)); - if (memcmp(&uuid, &uuid_null, sizeof(uuid_t)) == 0) + if (uuid_is_null(&uuid)) return COMMAND_ERROR_USAGE; desc = lookup_image_desc_from_uuid(fip, &uuid); diff --git a/lib/fip.c b/lib/fip.c index 63f1469086..774de2ad1d 100644 --- a/lib/fip.c +++ b/lib/fip.c @@ -127,7 +127,7 @@ struct fip_image_desc *lookup_image_desc_from_uuid(struct fip_state *fip, struct fip_image_desc *desc; fip_for_each_desc(fip, desc) - if (memcmp(&desc->uuid, uuid, sizeof(uuid_t)) == 0) + if (uuid_equal(&desc->uuid, uuid)) return desc; return NULL; } @@ -210,7 +210,7 @@ int parse_fip(struct fip_state *fip, struct fip_image_desc *desc; /* Found the ToC terminator, we are done. */ - if (memcmp(&toc_entry->uuid, &uuid_null, sizeof(uuid_t)) == 0) { + if (uuid_is_null(&toc_entry->uuid)) { terminated = 1; break; } -- 2.39.5