if (this_zero_block_size > largest_zero_block_size) {
largest_zero_block_size = this_zero_block_size;
largest_zero_block_offset = this_zero_block_offset;
+ /*
+ * clang-analyzer hates these because they're the last use,
+ * and they don't believe in writing code so that bugs won't
+ * be introduced later...
+ */
+#if 0
this_zero_block_size = 0;
this_zero_block_offset = -1;
in_zero_block = 0;
+#endif
}
if (largest_zero_block_size == 1)
largest_zero_block_offset = -1;
static void
show_variable(char *guid_name, int display_type)
{
- efi_guid_t guid;
+ efi_guid_t guid = efi_guid_empty;
char *name = NULL;
int rc;
uint32_t attributes;
parse_name(guid_name, &name, &guid);
+ if (!name || efi_guid_is_empty(&guid)) {
+ fprintf(stderr, "efivar: could not parse variable name.\n");
+ show_errors();
+ exit(1);
+ }
errno = 0;
rc = efi_get_variable(guid, name, &data, &data_size, &attributes);
}
printf("\n");
}
+
+ free(name);
+ if (data)
+ free(data);
}
static void
edit_variable(const char *guid_name, void *data, size_t data_size,
uint32_t attrib, int edit_type)
{
- efi_guid_t guid;
+ efi_guid_t guid = efi_guid_empty;
char *name = NULL;
int rc;
uint8_t *old_data = NULL;
uint32_t old_attributes = 0;
parse_name(guid_name, &name, &guid);
+ if (!name || efi_guid_is_empty(&guid)) {
+ fprintf(stderr, "efivar: could not parse variable name.\n");
+ show_errors();
+ exit(1);
+ }
rc = efi_get_variable(guid, name, &old_data, &old_data_size,
&old_attributes);
break;
}
+ free(name);
+ if (old_data)
+ free(old_data);
+
if (rc < 0) {
fprintf(stderr, "efivar: %m\n");
show_errors();
&linksz, info);
if (rc < 0)
return -1;
- loff += linksz;
+ /*
+ * clang-analyzer complains about this because they
+ * don't believe in writing code to avoid introducing
+ * bugs later.
+ */
+ // loff += linksz;
off += sz;
found = 1;
}
if (sz < 0)
return -1;
off += sz;
- loff += tmplsz;
+ /*
+ * clang-analyzer complains about this because they don't believe in
+ * writing code to avoid introducing bugs later.
+ */
+ //loff += tmplsz;
return off;
}