Unchecked return value on third party code

Joel Sherrill joel at rtems.org
Tue Feb 23 15:23:54 UTC 2021


Hi

Ryan has wandered into the land of third party code and Coverity issues. It
is not a very welcoming land and we need to decide what we want to do as a
project. I put one

In these cases, we have a few patterns to fall back on. There are basically
a few choices here:

+ ignore third party code in Coverity. I'm not a fan since we still have
code with issues.

  + Do the minimum which is often just adding (void) in front of the call
not checking a return code..Still wrap in #ifdef __rtems__ as below with a
more robust solution.

+ Add #ifdef __rtems__ so the original code and rtems changes are side by
side. This is more like what we do with libbsd. But I would still tend to
use the correct fix and not just slap a (void) in front. If we are going to
modify the file, we might as well fix it.

#ifdef __rtems__
   rc = XXX
   _Assert_Unused_variable_equals'
#else
   XXX
#endif

Any other options? Opinions.

--joel

============================
 CID 1047324: Unchecked return value in fdt_add_subnode_namelen().

Closes #4256
---
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..ceeeb44 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20210223/0c0b5833/attachment-0001.html>


More information about the devel mailing list