Date: Wed, 24 Jul 2013 16:22:27 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253615 - head/sys/kern Message-ID: <201307241622.r6OGMRGO034202@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Wed Jul 24 16:22:27 2013 New Revision: 253615 URL: http://svnweb.freebsd.org/changeset/base/253615 Log: 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@ Modified: head/sys/kern/kern_uuid.c Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Wed Jul 24 15:46:49 2013 (r253614) +++ head/sys/kern/kern_uuid.c Wed Jul 24 16:22:27 2013 (r253615) @@ -200,8 +200,7 @@ sys_uuidgen(struct thread *td, struct uu 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307241622.r6OGMRGO034202>