diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-04 01:11:35 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-04 01:12:11 +0000 |
| commit | 12778a0ffdb2744a9fd7e4ad2ba6e7c320b4a711 (patch) | |
| tree | dc413cd90d3b265136b75a7b304f4de7a3a89a93 | |
| parent | 84376fa3080a1734249f88375bb216c3d523e06f (diff) | |
util/nvmutil: simplified zero-mac-address check
it's just three words. access them directly.
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 6ce4a863..ea799997 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -320,9 +320,7 @@ cmd_setmac(void) static void parse_mac_string(void) { - size_t c; int mac_pos; - uint64_t mac_total; if (strnlen(mac, 20) != 17) err(EINVAL, "MAC address is the wrong length"); @@ -330,11 +328,7 @@ parse_mac_string(void) for (mac_pos = 0; mac_pos < 16; mac_pos += 3) set_mac_byte(mac_pos); - mac_total = 0; - for (c = 0; c < 3; c++) - mac_total += macbuf[c]; - - if (mac_total == 0) + if ((macbuf[0] | macbuf[1] | macbuf[2]) == 0) err(EINVAL, "Must not specify all-zeroes MAC address"); if (macbuf[0] & 1) err(EINVAL, "Must not specify multicast MAC address"); |
