diff mbox series

[03/17] sandbox: Indicate NULL-pointer access in 'sigsegv' command

Message ID 20210508220021.1778080-4-sjg@chromium.org
State Changes Requested
Delegated to: Tom Rini
Headers show
Series Fix various coverity warnings | expand

Commit Message

Simon Glass May 8, 2021, 10 p.m. UTC
This is intended to crash. Add an annotation to keep coverity happy.

Reported-by: Coverity (CID: 316347)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/sandbox/exception.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Tom Rini May 10, 2021, 1:07 p.m. UTC | #1
On Sat, May 08, 2021 at 04:00:07PM -0600, Simon Glass wrote:

> This is intended to crash. Add an annotation to keep coverity happy.
> 
> Reported-by: Coverity (CID: 316347)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  cmd/sandbox/exception.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/cmd/sandbox/exception.c b/cmd/sandbox/exception.c
> index 1aa1d673aed..d865922e863 100644
> --- a/cmd/sandbox/exception.c
> +++ b/cmd/sandbox/exception.c
> @@ -13,7 +13,9 @@ static int do_sigsegv(struct cmd_tbl *cmdtp, int flag, int argc,
>  {
>  	u8 *ptr = NULL;
>  
> +	/* coverity[FORWARD_NULL] */
>  	*ptr = 0;
> +
>  	return CMD_RET_FAILURE;

For here and later on in the series, I would rather just mark some as
intentional in the dashboard and if it makes sense and isn't obvious
from the code (so not here, but elsewhere in this series) a comment
saying why we're doing something a static analysis tool is going to
catch.  Thanks!
diff mbox series

Patch

diff --git a/cmd/sandbox/exception.c b/cmd/sandbox/exception.c
index 1aa1d673aed..d865922e863 100644
--- a/cmd/sandbox/exception.c
+++ b/cmd/sandbox/exception.c
@@ -13,7 +13,9 @@  static int do_sigsegv(struct cmd_tbl *cmdtp, int flag, int argc,
 {
 	u8 *ptr = NULL;
 
+	/* coverity[FORWARD_NULL] */
 	*ptr = 0;
+
 	return CMD_RET_FAILURE;
 }