[Spice-commits] 2 commits - common/quic.c common/quic_family_tmpl.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Wed Jul 23 09:47:01 PDT 2014


 common/quic.c             |   12 +++++-------
 common/quic_family_tmpl.c |    2 ++
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit d45b3e2765ec130d047020d34985e65fa7fb166b
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Jul 14 22:01:38 2014 +0200

    quic_family_tmpl: Fix "FORWARD_NULL" caught by coverity
    
    Ensure the received bucket is non NULL

diff --git a/common/quic_family_tmpl.c b/common/quic_family_tmpl.c
index 12ef62f..9a434e0 100644
--- a/common/quic_family_tmpl.c
+++ b/common/quic_family_tmpl.c
@@ -72,6 +72,8 @@ static void FNAME(update_model)(CommonState *state, s_bucket * const bucket,
                                 const BYTE curval)
 {
     spice_static_assert(BPC >= 1);
+    spice_return_if_fail (bucket != NULL);
+
     const unsigned int bpp = BPC;
     COUNTER * const pcounters = bucket->pcounters;
     unsigned int i;
commit 7e4cfbe305c303a30dc6a07cc7514d5a55d8613d
Author: Fabiano Fidêncio <fidencio at redhat.com>
Date:   Mon Jul 14 18:39:51 2014 +0200

    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.

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;


More information about the Spice-commits mailing list