On 03/05/2013 05:43 AM, John Ferlan wrote: > Add a Coverity dead_error_condition tag since it's not possible for next > to be NULL at that point and thus exit the while loop. If next were NULL > the condition to set it would have done the return -1. > --- > src/storage/storage_backend_sheepdog.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c > index 218284d..7b564bd 100644 > --- a/src/storage/storage_backend_sheepdog.c > +++ b/src/storage/storage_backend_sheepdog.c > @@ -85,6 +85,8 @@ virStorageBackendSheepdogParseNodeInfo(virStoragePoolDefPtr pool, > pool->available = pool->capacity - pool->allocation; > return 0; > > + /* coverity[dead_error_condition] - since we return -1 above we'll > + * never get to return -1 below */ > } while ((p = next)); Instead of adding this fancy comment, why not just change the earlier 'return -1;' lines into 'break;'. Then the end of the function would be reachable, we'd no longer have dead code, we don't need a coverity-specific comment, and other code analyzers will not need similar tricks at a later date. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list