[Spice-devel] [PATCH] quic: Fix test which is always true
Uri Lublin
uril at redhat.com
Mon Jan 20 04:37:06 PST 2014
On 01/20/2014 01:11 PM, Christophe Fergeau wrote:
> find_model_params() is first doing *nbuckets = 0; and it then checks
> nbuckets for NULL. This is redundant as the dereferencing would a segfault,
> so the if (nbuckets) test can't be false.
> As Uri pointed out, the "/* bucket start */" comment on the same line
> probably implies that the test was meant to be 'if (*nbuckets)'
> I've ran a few test and I did not observe issues because of it...
Also, there is a comment where bstart and bend are defined
saying the buckets range is "0 to levels-1", and without this
patch the range starts at 1.
Ack.
Thanks,
Uri.
> ---
> common/quic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/quic.c b/common/quic.c
> index bcbf093..29459bc 100644
> --- a/common/quic.c
> +++ b/common/quic.c
> @@ -952,7 +952,7 @@ static void find_model_params(Encoder *encoder,
> bsize = *firstsize;
>
> do { /* other buckets */
> - if (nbuckets) { /* bucket start */
> + if (*nbuckets) { /* bucket start */
> bstart = bend + 1;
> } else {
> bstart = 0;
More information about the Spice-devel
mailing list