summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2014-07-14 18:39:51 +0200
committerFabiano FidĂȘncio <fidencio@redhat.com>2014-07-23 17:20:30 +0200
commit7e4cfbe305c303a30dc6a07cc7514d5a55d8613d (patch)
tree078e10ef0180f1e7db6968f947fd928cab5b3871 /common
parent2c5041c3f85564d0cc90b1414b668f696ba1104f (diff)
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.
Diffstat (limited to 'common')
-rw-r--r--common/quic.c12
1 files changed, 5 insertions, 7 deletions
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;