Re: [PATCH 12/34] cyclictest: fix off-by-one in clocksel check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, 22 May 2017, Tommi Rantala wrote:

> Fix off-by-one when checking that clocksel is valid index to the array.
> 
> Also fix a compiler warning:
> 
> src/cyclictest/cyclictest.c: In function 'process_options':
> src/cyclictest/cyclictest.c:1828:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
>   if (clocksel < 0 || clocksel > ARRAY_SIZE(clocksources))
> 
> Signed-off-by: Tommi Rantala <tommi.t.rantala@xxxxxxxxx>
> ---
>  src/cyclictest/cyclictest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
> index f2747e4..d89cb0f 100644
> --- a/src/cyclictest/cyclictest.c
> +++ b/src/cyclictest/cyclictest.c
> @@ -1823,7 +1823,7 @@ static void process_options (int argc, char *argv[], int max_cpus)
>  	if (tracelimit)
>  		fileprefix = procfileprefix;
>  
> -	if (clocksel < 0 || clocksel > ARRAY_SIZE(clocksources))
> +	if (clocksel < 0 || clocksel >= (int)ARRAY_SIZE(clocksources))
>  		error = 1;
>  
>  	if (oscope_reduction < 1)
> -- 

Signed-off-by: John Kacur <jkacur@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux