All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc/coverity: Model __builtin_unreachable()
@ 2014-09-24 13:53 Andrew Cooper
  2014-09-24 14:50 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2014-09-24 13:53 UTC (permalink / raw)
  To: Xen-devel
  Cc: Keir Fraser, Ian Campbell, Andrew Cooper, Tim Deegan, coverity,
	Jan Beulich, Ian Jackson

This resolves 23 issues Coverity had identified by following the false path of
an ASSERT().

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: coverity@xenproject.org
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 misc/coverity/model.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/misc/coverity/model.c b/misc/coverity/model.c
index fac2ecb..bd62566 100644
--- a/misc/coverity/model.c
+++ b/misc/coverity/model.c
@@ -121,6 +121,16 @@ void libxl__ctx_unlock(libxl_ctx *ctx)
 }
 
 /*
+ * Coverity doesn't understand __builtin_unreachable(), which causes it to
+ * incorrectly find issues based on continuing execution along the false
+ * branch of an ASSERT().
+ */
+void __builtin_unreachable(void)
+{
+    __coverity_panic__();
+}
+
+/*
  * Local variables:
  * mode: C
  * c-file-style: "BSD"
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] misc/coverity: Model __builtin_unreachable()
  2014-09-24 13:53 [PATCH] misc/coverity: Model __builtin_unreachable() Andrew Cooper
@ 2014-09-24 14:50 ` Jan Beulich
  2014-09-24 14:56   ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2014-09-24 14:50 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: KeirFraser, Ian Campbell, Ian Jackson, Tim Deegan, coverity, Xen-devel

>>> On 24.09.14 at 15:53, <andrew.cooper3@citrix.com> wrote:
>  /*
> + * Coverity doesn't understand __builtin_unreachable(), which causes it to
> + * incorrectly find issues based on continuing execution along the false
> + * branch of an ASSERT().
> + */
> +void __builtin_unreachable(void)
> +{
> +    __coverity_panic__();
> +}

And (for those of us without intimate knowledge of Coverity)
__coverity_panic__() does what? By its name I would conclude
it terminates the current scan altogether...

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] misc/coverity: Model __builtin_unreachable()
  2014-09-24 14:50 ` Jan Beulich
@ 2014-09-24 14:56   ` Andrew Cooper
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2014-09-24 14:56 UTC (permalink / raw)
  To: Jan Beulich
  Cc: KeirFraser, Ian Campbell, Ian Jackson, Tim Deegan, coverity, Xen-devel

On 24/09/14 15:50, Jan Beulich wrote:
>>>> On 24.09.14 at 15:53, <andrew.cooper3@citrix.com> wrote:
>>  /*
>> + * Coverity doesn't understand __builtin_unreachable(), which causes it to
>> + * incorrectly find issues based on continuing execution along the false
>> + * branch of an ASSERT().
>> + */
>> +void __builtin_unreachable(void)
>> +{
>> +    __coverity_panic__();
>> +}
> And (for those of us without intimate knowledge of Coverity)
> __coverity_panic__() does what? By its name I would conclude
> it terminates the current scan altogether...
>
> Jan
>

__coverity_panic__() is a coverity modelling function defined as "ending
the current execution path".  (See https://scan.coverity.com/tune which
might be behind a login)

Its naming is somewhat unfortunate.

~Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-24 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-24 13:53 [PATCH] misc/coverity: Model __builtin_unreachable() Andrew Cooper
2014-09-24 14:50 ` Jan Beulich
2014-09-24 14:56   ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.