static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *option_table, char *name)
{
struct cb_cmos_entries *cmos_entry;
- int len = strnlen(name, CMOS_MAX_NAME_LENGTH);
+ int len = name ? strnlen(name, CMOS_MAX_NAME_LENGTH) : 0;
/* cmos entries are located right after the option table */
struct cb_cmos_entries *first_cmos_entry(struct cb_cmos_option_table *option_table)
{
- return lookup_cmos_entry(option_table, "");
+ return lookup_cmos_entry(option_table, NULL);
}
struct cb_cmos_entries *next_cmos_entry(struct cb_cmos_entries *cmos_entry)
*dest = strdup((const char*)cmos_enum->text);
break;
default: /* fail */
- return 1;
+ ret = 1;
}
free(raw);
return ret;
switch (cmos_entry->config) {
case 'h':
/* only works on little endian */
- raw = malloc(8);
+ raw = malloc(sizeof(u64));
*(u64*)raw = strtoull(value, NULL, 0);
break;
case 's':