mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user