In uuid_ether_add(), avoid false positives due to the limited type
used to hold the sum of the bytes of the MAC address. While here, rename the variable that holds the sum from 'c' to 'sum'. Pointed out by: thompsa@
This commit is contained in:
parent
b9740ba1a8
commit
8ff6ca1e08
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=253615
@ -200,8 +200,7 @@ sys_uuidgen(struct thread *td, struct uuidgen_args *uap)
|
||||
int
|
||||
uuid_ether_add(const uint8_t *addr)
|
||||
{
|
||||
int i;
|
||||
uint8_t c;
|
||||
int i, sum;
|
||||
|
||||
/*
|
||||
* Validate input. No multicast addresses and no addresses that
|
||||
@ -209,10 +208,10 @@ uuid_ether_add(const uint8_t *addr)
|
||||
*/
|
||||
if (addr[0] & 0x01)
|
||||
return (EINVAL);
|
||||
c = 0;
|
||||
sum = 0;
|
||||
for (i = 0; i < UUID_NODE_LEN; i++)
|
||||
c += addr[i];
|
||||
if (c == 0)
|
||||
sum += addr[i];
|
||||
if (sum == 0)
|
||||
return (EINVAL);
|
||||
|
||||
mtx_lock(&uuid_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user