[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] RFC xen: suppress Coverity warnings about atomic_read and atomic_set.



On Fri, Sep 13, 2013 at 1:47 AM, Tim Deegan <tim@xxxxxxx> wrote:
> RFC because I'm not sure what people think about scattering coverity
> annotations in the code.

This patch of mine (which I'm posting here as part of the RFC
discussion only) adds a Coverity annotation as well. Doing this might
also make Coverity start complaining that the watch list is mutated
without holding the watch_mutex, but that would only be a single
defect instead of many, and easy to triage as False Positive.

Another possible annotation-based fix would be to make a wrapper
around cleanup_push(pthread_mutex_unlock, <mutex>) that was annotated
as unlocking <mutex>, which I guess makes more sense.

Then again, the CIDs could also probably be silenced by modifying the
unlock to be done directly.


Author: Matthew Daley <mattjd@xxxxxxxxx>
Date:   Thu Sep 12 15:33:02 2013 +1200

    xenstore: prevent Coverity from being confused in read_message

    Coverity cannot see the cleanup_push'd unlock of watch_mutex, so
    annotate the lock so that it is ignored. This will silence many CIDs
    scattered around the project (eg. wherever xs_{read,write,...} are used)

    Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>

diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c
index 86ef6c7..d12e42f 100644
--- a/tools/xenstore/xs.c
+++ b/tools/xenstore/xs.c
@@ -1154,6 +1154,7 @@ static int read_message(struct xs_handle *h, int
nonblocking)
        body[msg->hdr.len] = '\0';

        if (msg->hdr.type == XS_WATCH_EVENT) {
+               /* coverity[lock] */
                mutex_lock(&h->watch_mutex);
                cleanup_push(pthread_mutex_unlock, &h->watch_mutex);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.