From 7e4cfbe305c303a30dc6a07cc7514d5a55d8613d Mon Sep 17 00:00:00 2001 From: Fabiano FidĂȘncio Date: Mon, 14 Jul 2014 18:39:51 +0200 Subject: quic: Fix "UNINIT" caught by coverity In case of the model evolution mode has a obsolete or non-valid value, just return, avoiding then the usage of non initalized variables. --- common/quic.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'common') diff --git a/common/quic.c b/common/quic.c index 4584336..90ea47b 100644 --- a/common/quic.c +++ b/common/quic.c @@ -911,9 +911,12 @@ static void find_model_params(Encoder *encoder, unsigned int bstart, bend = 0; /* bucket start and end, range : 0 to levels-1*/ unsigned int repcntr; /* helper */ + /* The only valid values are 1, 3 and 5. + 0, 2 and 4 are obsolete and the rest of the + values are considered out of the range. */ + spice_static_assert (evol == 1 || evol == 3 || evol == 5); spice_assert(bpc <= 8 && bpc > 0); - *ncounters = 8; *levels = 0x1 << bpc; @@ -939,14 +942,9 @@ static void find_model_params(Encoder *encoder, *repnext = 1; *mulsize = 4; break; - case 0: /* obsolete */ - case 2: /* obsolete */ - case 4: /* obsolete */ - encoder->usr->error(encoder->usr, "findmodelparams(): evol value obsolete!!!\n"); - break; default: encoder->usr->error(encoder->usr, "findmodelparams(): evol out of range!!!\n"); - break; + return; } *nbuckets = 0; -- cgit v1.2.3