mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
libfdt: Fix a possible "unchecked return value" warning
Apparently the unchecked return value of the first fdt_next_tag() call in fdt_add_subnode_namelen() is tripping Coverity Scan in some circumstances, although it appears not to for the scan on our project itself. This fdt_next_tag() should always return FDT_BEGIN_NODE, since otherwise the fdt_subnode_offset_namelen() above would have returned BADOFFSET or BADSTRUCTURE. Still, add a check to shut Coverity up, gated by a can_assume() to avoid bloat in small builds. Reported-by: Ryan Long <ryan.long@oarcorp.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
committed by
Sebastian Huber
parent
a582ab37c2
commit
a3fa0702c8
@@ -349,7 +349,10 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
|
|||||||
return offset;
|
return offset;
|
||||||
|
|
||||||
/* Try to place the new node after the parent's properties */
|
/* Try to place the new node after the parent's properties */
|
||||||
fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
|
tag = fdt_next_tag(fdt, parentoffset, &nextoffset);
|
||||||
|
/* the fdt_subnode_offset_namelen() should ensure this never hits */
|
||||||
|
if (!can_assume(LIBFDT_FLAWLESS) && (tag != FDT_BEGIN_NODE))
|
||||||
|
return -FDT_ERR_INTERNAL;
|
||||||
do {
|
do {
|
||||||
offset = nextoffset;
|
offset = nextoffset;
|
||||||
tag = fdt_next_tag(fdt, offset, &nextoffset);
|
tag = fdt_next_tag(fdt, offset, &nextoffset);
|
||||||
|
|||||||
Reference in New Issue
Block a user