diff options
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 43afe9d1..3b97b5c1 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -401,12 +401,15 @@ static void set_mac_nib(int mac_pos, int nib) { uint8_t h; - int byte = mac_pos / 3; + int byte; + int shift; if ((h = hextonum(mac[mac_pos + nib])) > 15) err(EINVAL, "Invalid character '%c'", mac[mac_pos + nib]); + byte = mac_pos / 3; + /* If random, ensure that local/unicast bits are set */ if ((byte == 0) && (nib == 1) && ((mac[mac_pos + nib] == '?') || @@ -421,7 +424,7 @@ set_mac_nib(int mac_pos, int nib) * we store the MAC address in reverse order * per 2-byte word (there are 3 of these). */ - int shift = (byte & 1) << 3; /* left or right byte? */ + shift = (byte & 1) << 3; /* left or right byte? */ shift |= (nib ^ 1) << 2; /* left or right nib? */ /* |
