summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2013-07-24 16:22:27 +0000
committermarcel <marcel@FreeBSD.org>2013-07-24 16:22:27 +0000
commitd7c9064369b19109fc414cdecafaf5accd2d5fab (patch)
tree2bdbf41beafe7fb577fe309e2faab09128ead5b1
parente34a7fd4710fdb4a381a1c6f7e62dce24c35b171 (diff)
downloadFreeBSD-src-d7c9064369b19109fc414cdecafaf5accd2d5fab.zip
FreeBSD-src-d7c9064369b19109fc414cdecafaf5accd2d5fab.tar.gz
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@
-rw-r--r--sys/kern/kern_uuid.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/kern_uuid.c b/sys/kern/kern_uuid.c
index c647a3f..a739428 100644
--- a/sys/kern/kern_uuid.c
+++ b/sys/kern/kern_uuid.c
@@ -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);
OpenPOWER on IntegriCloud