* [PATCH] Unchecked return value error in fdt_rw.c
@ 2021-03-01 22:24 Ryan Long
[not found] ` <1614637450-4972-1-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Ryan Long @ 2021-03-01 22:24 UTC (permalink / raw)
To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA; +Cc: Ryan Long
Hi,
I filed an issue on github, but I was told it'd be good to send this to
the mailing list as well.
RTEMS (RTEMS.org) is a free single process, multi-threaded real-time operating
system with a long history. Your dtc toolchain has been incorporated into
RTEMS. The RTEMS Project is a member of the Coverity Scan program and it
flagged an issue with /dtc/libfdt/fdt_rw.c. In trying to be good citizens of
the wider open source community, the project wants these issues to be reported
to the upstream owner along with a fix or suggestions. This is one of those
reports.
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 like so.
int status = fdt_next_tag(fdt, parentoffsetm &nextoffset);
assert(status == 0);
(void)status;
For this patch, I just put the "(void)" statement in front of the
function call, and it achieves the same results. Could this be put in?
We don't want to deviate from our upstream codebases, but we would also
like to get rid of these errors.
Thanks,
Ryan
Ryan Long (1):
fdt_rw.c: Fix Unchecked return value error
cpukit/dtc/libfdt/fdt_rw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <1614637450-4972-1-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>]
* [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> 2021-03-02 2:29 ` [PATCH] Unchecked return value error in fdt_rw.c Rob Herring 1 sibling, 1 reply; 5+ 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] 5+ messages in thread
[parent not found: <1614637450-4972-2-git-send-email-ryan.long-lGxtRh3/QYtBDgjK7y7TUQ@public.gmane.org>]
* 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; 5+ 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] 5+ messages in thread
* Re: [PATCH] Unchecked return value error in fdt_rw.c [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 @ 2021-03-02 2:29 ` Rob Herring [not found] ` <CAL_JsqK68HjwdT5+-kjo3Yr7XokC=6ioa7dkMzeUsve8iEzVxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 1 sibling, 1 reply; 5+ messages in thread From: Rob Herring @ 2021-03-02 2:29 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: > > Hi, > > I filed an issue on github, but I was told it'd be good to send this to > the mailing list as well. > > RTEMS (RTEMS.org) is a free single process, multi-threaded real-time operating > system with a long history. Your dtc toolchain has been incorporated into > RTEMS. The RTEMS Project is a member of the Coverity Scan program and it > flagged an issue with /dtc/libfdt/fdt_rw.c. In trying to be good citizens of > the wider open source community, the project wants these issues to be reported > to the upstream owner along with a fix or suggestions. This is one of those > reports. > > 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 like so. Humm, I think Coverity scans run on the Linux kernel too, but I've never seen any reports on the kernel's copy. Just wondering why... Rob ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CAL_JsqK68HjwdT5+-kjo3Yr7XokC=6ioa7dkMzeUsve8iEzVxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] Unchecked return value error in fdt_rw.c [not found] ` <CAL_JsqK68HjwdT5+-kjo3Yr7XokC=6ioa7dkMzeUsve8iEzVxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2021-03-03 8:33 ` David Gibson 0 siblings, 0 replies; 5+ messages in thread From: David Gibson @ 2021-03-03 8:33 UTC (permalink / raw) To: Rob Herring; +Cc: Ryan Long, Devicetree Compiler, Ryan Long [-- Attachment #1: Type: text/plain, Size: 1460 bytes --] On Mon, Mar 01, 2021 at 08:29:49PM -0600, Rob Herring wrote: > On Mon, Mar 1, 2021 at 4:27 PM Ryan Long <thisisryanlong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, > > > > I filed an issue on github, but I was told it'd be good to send this to > > the mailing list as well. > > > > RTEMS (RTEMS.org) is a free single process, multi-threaded real-time operating > > system with a long history. Your dtc toolchain has been incorporated into > > RTEMS. The RTEMS Project is a member of the Coverity Scan program and it > > flagged an issue with /dtc/libfdt/fdt_rw.c. In trying to be good citizens of > > the wider open source community, the project wants these issues to be reported > > to the upstream owner along with a fix or suggestions. This is one of those > > reports. > > > > 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 like so. > > Humm, I think Coverity scans run on the Linux kernel too, but I've > never seen any reports on the kernel's copy. Just wondering why... It runs on dtc upstream as well. -- 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] 5+ messages in thread
end of thread, other threads:[~2021-03-03 8:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2021-03-02 2:29 ` [PATCH] Unchecked return value error in fdt_rw.c Rob Herring
[not found] ` <CAL_JsqK68HjwdT5+-kjo3Yr7XokC=6ioa7dkMzeUsve8iEzVxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-03-03 8:33 ` David Gibson
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).