[LTP] [PATCH] getrandom02: relax check for returned data

Cyril Hrubis chrubis@suse.cz
Tue Feb 7 16:33:52 CET 2017


Hi!
> +			} else {
>  				tst_resm(TPASS, "getrandom returned %ld",
>  						TEST_RETURN);
> +				tmp = 0;
> +				for (j = 0; j < TEST_RETURN; j++)
> +					tmp |= buf[j];
> +				if (tmp == 0)
> +					tst_resm(TWARN, "all bytes from random"
> +						" buffer are zero?");

This wouldn't for instance when the random output is filled with
non-zero constant bytes...

What about just fixing the max value to something as:

max = 3 + nb * 0.2;

The constat part should handle cases with small buffer and a few
repeating characters while for larger buffer it's neglectible.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list