Date: Wed, 5 Oct 2016 18:33:28 -0400 From: "Philip M. Gollucci" <pgollucci@p6m7g8.com> To: Alan Cox <alc@freebsd.org> Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r306713 - in user/alc/PQ_LAUNDRY: lib/libc/stdlib lib/msun/ld80 lib/msun/src sys/cam sys/vm Message-ID: <CACM2dAa0XrUm4zBaPnSQGrHY8%2B2RLYU5PKC%2BtgDTPrP0_r52XQ@mail.gmail.com> In-Reply-To: <201610051803.u95I3Hq1040052@repo.freebsd.org> References: <201610051803.u95I3Hq1040052@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
I know you(Alan) didn't write this, its from the MFH, but how would len != expected. neither are initialized or passed in both times its set its expected = len = foo On Wed, Oct 5, 2016 at 2:03 PM, Alan Cox <alc@freebsd.org> wrote: > Modified: user/alc/PQ_LAUNDRY/lib/libc/stdlib/random.c > ============================================================ > ================== > --- user/alc/PQ_LAUNDRY/lib/libc/stdlib/random.c Wed Oct 5 > 17:32:06 2016 (r306712) > +++ user/alc/PQ_LAUNDRY/lib/libc/stdlib/random.c Wed Oct 5 > 18:03:17 2016 (r306713) > @@ -270,16 +270,17 @@ void > srandomdev(void) > { > int mib[2]; > - size_t len; > + size_t expected, len; > > if (rand_type == TYPE_0) > - len = sizeof(state[0]); > + expected = len = sizeof(state[0]); > else > - len = rand_deg * sizeof(state[0]); > + expected = len = rand_deg * sizeof(state[0]); > > mib[0] = CTL_KERN; > mib[1] = KERN_ARND; > - sysctl(mib, 2, state, &len, NULL, 0); > + if (sysctl(mib, 2, state, &len, NULL, 0) == -1 || len != expected) > + abort(); > > if (rand_type != TYPE_0) { > fptr = &state[rand_sep]; > -- --------------------------------------------------------------------------------- 4096R/D21D2752 <http://pgp.mit.edu/pks/lookup?op=get&search=0xF699A450D21D2752> ECDF B597 B54B 7F92 753E E0EA F699 A450 D21D 2752 Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354 Member, Apache Software Foundation Committer, FreeBSD Foundation Consultant, P6M7G8 Inc. Director Cloud Technology, Capital One What doesn't kill us can only make us stronger; Except it almost kills you.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACM2dAa0XrUm4zBaPnSQGrHY8%2B2RLYU5PKC%2BtgDTPrP0_r52XQ>