devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fdt_rw.c: Fix Unchecked return value error
       [not found] ` <1614637450-4972-1-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
@ 2021-03-01 22:24   ` Ryan Long
       [not found]     ` <1614637450-4972-2-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Ryan Long @ 2021-03-01 22:24 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Ryan Long

Fixed "Unchecked return value" error, by adding "(void)" in front of the
function call.
---
 cpukit/dtc/libfdt/fdt_rw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
index 1385425..cdae5dd 100644
--- a/cpukit/dtc/libfdt/fdt_rw.c
+++ b/cpukit/dtc/libfdt/fdt_rw.c
@@ -348,7 +348,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
 		return offset;
 
 	/* Try to place the new node after the parent's properties */
-	fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+	(void) fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
 	do {
 		offset = nextoffset;
 		tag = fdt_next_tag(fdt, offset, &nextoffset);
-- 
1.8.3.1


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

* Re: [PATCH] fdt_rw.c: Fix Unchecked return value error
       [not found]     ` <1614637450-4972-2-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
@ 2021-03-02  2:26       ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2021-03-02  2:26 UTC (permalink / raw)
  To: Ryan Long; +Cc: Devicetree Compiler, Ryan Long

On Mon, Mar 1, 2021 at 4:27 PM Ryan Long <thisisryanlong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> Fixed "Unchecked return value" error, by adding "(void)" in front of the
> function call.

You don't need cover letters for single patches. Move the explanation
here because it's a lot better at explaining the why. The what is not
needed here so much because we can read what the patch does.

You also need a S-o-b.

> ---
>  cpukit/dtc/libfdt/fdt_rw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
> index 1385425..cdae5dd 100644
> --- a/cpukit/dtc/libfdt/fdt_rw.c
> +++ b/cpukit/dtc/libfdt/fdt_rw.c
> @@ -348,7 +348,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
>                 return offset;
>
>         /* Try to place the new node after the parent's properties */
> -       fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
> +       (void) fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */

Can't we just actually check the error here?

>         do {
>                 offset = nextoffset;
>                 tag = fdt_next_tag(fdt, offset, &nextoffset);
> --
> 1.8.3.1
>

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

* [PATCH] fdt_rw.c: Fix Unchecked return value error
@ 2021-03-02 19:58 Ryan Long
       [not found] ` <1614715099-23657-1-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Ryan Long @ 2021-03-02 19:58 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Ryan Long

Fixed "Unchecked return value" error, by adding "(void)" in front of the
function call.

When Coverity Scan was ran on some of your code, a "Unchecked return value"
error was found at line 352 in fdt_rw.c. For similar errors that we received
for RTEMS, we created a macro that will assert the value returned and "use" the
return value with (void).

Signed-off-by: Ryan Long <ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
---
 cpukit/dtc/libfdt/fdt_rw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
index 1385425..cdae5dd 100644
--- a/cpukit/dtc/libfdt/fdt_rw.c
+++ b/cpukit/dtc/libfdt/fdt_rw.c
@@ -348,7 +348,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
 		return offset;
 
 	/* Try to place the new node after the parent's properties */
-	fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+	(void) fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
 	do {
 		offset = nextoffset;
 		tag = fdt_next_tag(fdt, offset, &nextoffset);
-- 
1.8.3.1


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

* Re: [PATCH] fdt_rw.c: Fix Unchecked return value error
       [not found] ` <1614715099-23657-1-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
@ 2021-03-09  3:52   ` David Gibson
  0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2021-03-09  3:52 UTC (permalink / raw)
  To: Ryan Long; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Ryan Long

[-- Attachment #1: Type: text/plain, Size: 1806 bytes --]

On Tue, Mar 02, 2021 at 02:58:19PM -0500, Ryan Long wrote:
> Fixed "Unchecked return value" error, by adding "(void)" in front of the
> function call.
> 
> When Coverity Scan was ran on some of your code, a "Unchecked return value"
> error was found at line 352 in fdt_rw.c. For similar errors that we received
> for RTEMS, we created a macro that will assert the value returned and "use" the
> return value with (void).
> 
> Signed-off-by: Ryan Long <ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>

It's weird that the Coverity Scan on dtc upstream didn't pick this
up.  I thought maybe it did at some point and I just marked it as a
false positive, but I looked through and I couldn't seem to find it at
all (though the Coverity UI is pretty confusing, so maybe I just
missed it).

I've taken a slightly different approach to squashing this upstream,
so I haven't applied this as is.

> ---
>  cpukit/dtc/libfdt/fdt_rw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
> index 1385425..cdae5dd 100644
> --- a/cpukit/dtc/libfdt/fdt_rw.c
> +++ b/cpukit/dtc/libfdt/fdt_rw.c
> @@ -348,7 +348,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
>  		return offset;
>  
>  	/* Try to place the new node after the parent's properties */
> -	fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
> +	(void) fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
>  	do {
>  		offset = nextoffset;
>  		tag = fdt_next_tag(fdt, offset, &nextoffset);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-03-09  3:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-02 19:58 [PATCH] fdt_rw.c: Fix Unchecked return value error Ryan Long
     [not found] ` <1614715099-23657-1-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
2021-03-09  3:52   ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2021-03-01 22:24 [PATCH] Unchecked return value error in fdt_rw.c Ryan Long
     [not found] ` <1614637450-4972-1-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
2021-03-01 22:24   ` [PATCH] fdt_rw.c: Fix Unchecked return value error Ryan Long
     [not found]     ` <1614637450-4972-2-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
2021-03-02  2:26       ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).