[Spice-devel] [spice-common][PATCH 1/2] quic: Fix "UNINIT" caught by coverity
Fabiano Fidêncio
fidencio at redhat.com
Tue Jul 15 01:12:22 PDT 2014
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(-)
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;
--
1.9.3
More information about the Spice-devel
mailing list