[Spice-devel] [PATCH 3/3] Fix "NULL_RETURNS" caught by coverity

Fabiano Fidêncio fabiano at fidencio.org
Mon Jul 14 04:44:45 PDT 2014


On Mon, Jul 14, 2014 at 1:30 PM, Marc-André Lureau <mlureau at redhat.com>
wrote:

>
>
> ----- Original Message -----
> > Hi Marc,
> >
> >
> > On Mon, Jul 14, 2014 at 12:19 PM, Marc-André Lureau < mlureau at redhat.com
> >
> > wrote:
> >
> >
> > Hi,
> >
> > All of those changes are OOM conditions. How can we shut coverity on
> those?
> >
> > Yes, there is a simple way and that's what we have in Evolution Data
> Server.
> > Long story short, we can just add some comments in the code like: /*
> > coverity[unchecked_value] */
> > Please, take a look on:
> >
> https://git.gnome.org/browse/evolution-data-server/commit/?id=a317be96dcffe6ce2c5900fe4e76d955e2294ce9
>
> I don't see allocation failure workarounds here.
>

The workaround would be adding something like this:

/* We don't handle OOM conditions in spice-gtk */
 /* coverity[null_returns] */


 > Can I go for it?
>
> For consistency, I would prefer to avoid checking for allocation failures.
>
> Also using glib API for allocations for the same reason.
>
> >
> > Why does it warn here and not for other allocations?
> >
> > Hmmm. I don't know, maybe these are the cases where we are using the
> members
> > of the structure right after the allocation fail, but it's just a guess.
> >
>
> Could malloc & free do not have annotations like the glib ones.
>
> What happens for example if you replace malloc() by g_malloc(), and free()
> by g_free() in the function below?
>

I don't think that would help as one of the Coverity's complaints came
from: "data = g_malloc(d->area.width * d->area.height * 3);"


Best Regards,
-- 
Fabiano Fidêncio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140714/9aca80aa/attachment-0001.html>


More information about the Spice-devel mailing list