nvramtool: Fix CMOS checksum to match coreboot (and /dev/nvram)
[coreboot.git] / util / nvramtool / cmos_ops.c
index 86ffe1022b501f2519a42ecd2fed01b8a443683d..91c9f451ac1482fb888a2060ca8e1165507633ad 100644 (file)
@@ -125,7 +125,7 @@ int prepare_cmos_write(const cmos_entry_t * e, const char value_str[],
                /* See if the first character of 'value_str' (excluding
                 * any initial whitespace) is a minus sign.
                 */
-               for (p = value_str; isspace(*p); p++) ;
+               for (p = value_str; isspace((int)(unsigned char)*p); p++) ;
                negative = (*p == '-');
 
                out = strtoull(value_str, (char **)&p, 0);
@@ -210,7 +210,7 @@ uint16_t cmos_checksum_compute(void)
        for (i = cmos_checksum_start; i <= cmos_checksum_end; i++)
                sum += cmos_read_byte(i);
 
-       return ~((uint16_t) (sum & 0xffff));
+       return (uint16_t)(sum & 0xffff);
 }
 
 /****************************************************************************