[Spice-devel] [spice-common 7/8] quic: Remove test which is always TRUE

Christophe Fergeau cfergeau at redhat.com
Tue Jan 7 05:38:14 PST 2014


On Tue, Jan 07, 2014 at 01:47:12PM +0100, Christophe Fergeau wrote:
> Hey,
> 
> On Mon, Jan 06, 2014 at 03:35:24PM +0200, Uri Lublin wrote:
> > On 01/06/2014 01:22 PM, Christophe Fergeau wrote:
> > >find_model_params() is first dereferencing nbuckets when setting
> > >it to 0, and then it checks it for NULL. The NULL-check will never trigger
> > >as if the pointer was NULL, we'd crash when we dereference it.
> > >This commit removes the redundant test, but adds an assert so that we
> > >catch this condition if it ever happens.
> > >---
> > >  common/quic.c | 12 +++++++-----
> > >  1 file changed, 7 insertions(+), 5 deletions(-)
> > >
> > >diff --git a/common/quic.c b/common/quic.c
> > >index 2cffde5..cef05ae 100644
> > >--- a/common/quic.c
> > >+++ b/common/quic.c
> > >@@ -954,11 +954,13 @@ static void find_model_params(Encoder *encoder,
> > >      bsize = *firstsize;
> > >      do { /* other buckets */
> > 
> > Hi Christophe,
> > 
> > Maybe the condition was supposed to be
> >    if (*nbuckets)
> 
> That indeed makes a lot of sense. However, I'm uncomfortable changing code
> I don't understand, even quic still seems to be working after changning
> this. So not sure which way to go here :-/
> 

I've pushed the rest of the series, only this patch hasn't been pushed.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140107/099853a2/attachment.pgp>


More information about the Spice-devel mailing list