svn commit: r293134 - head/lib/libnv/tests

NGie Cooper yaneurabeya at gmail.com
Mon Jan 4 03:32:14 UTC 2016


> On Jan 3, 2016, at 19:26, Garrett Cooper <ngie at FreeBSD.org> wrote:
> 
> Author: ngie
> Date: Mon Jan  4 03:26:36 2016
> New Revision: 293134
> URL: https://svnweb.freebsd.org/changeset/base/293134
> 
> Log:
>  Use `nitems(x)` macro instead of using hardcoded numbers for indices into
>  the nvlists
> 
>  Convert some of the variables from int to unsigned int to squelch -Wsign-compare
>  warnings when converting hardcoded values to nitems(..)
> 
>  Differential Revision: https://reviews.freebsd.org/D4769 (part of larger diff)
>  MFC after: 5 days
>  Reviewed by: oshogbo
>  Sponsored by: EMC / Isilon Storage Division

...

> -		for (i = 0; i < num_items; i++)
> +		for (i = 0; i < nitems(desc); i++)

This portion of the change also fixed an out-of-bounds memory access on stable/10 that oshogbo spent some time poring over why this testcase (in particular) kept on crashing as num_items was never properly initialized in this code path.

Reported by: cppcheck

Thanks!
-NGie


More information about the svn-src-head mailing list