util/nvmutil: simplified zero-mac-address check

it's just three words. access them directly.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-04 01:11:35 +00:00
parent 84376fa308
commit 12778a0ffd
+1 -7
View File
@@ -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");