#3947 closed defect (fixed)

fdt_rw.c: Unchecked return value (CID #1047324)

Reported by: Joel Sherrill Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: lib Version: 5
Severity: normal Keywords: coverity, small, tasks
Cc: Blocked By:
Blocking:

Description

git blams says Sebastian.

*** CID 1047324:  Error handling issues  (CHECKED_RETURN)
/home/joel/rtems-work/rtems/cpukit/dtc/libfdt/fdt_rw.c: 351 in fdt_add_subnode_namelen()
345             if (offset >= 0)
346                     return -FDT_ERR_EXISTS;
347             else if (offset != -FDT_ERR_NOTFOUND)
348                     return offset;
349     
350             /* Try to place the new node after the parent's properties */
>>>     CID 1047324:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "fdt_next_tag" without checking return value (as is done elsewhere 7 out of 8 times).
351             fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
352             do {
353                     offset = nextoffset;
354                     tag = fdt_next_tag(fdt, offset, &nextoffset);
355             } while ((tag == FDT_PROP) || (tag == FDT_NOP));
356     

Change History (4)

comment:1 Changed on 04/10/20 at 15:34:56 by Joel Sherrill

Keywords: coverity small tasks added

comment:2 Changed on 04/10/20 at 20:13:59 by Sebastian Huber

Maybe this is already fixed in the upstream. Otherwise it should be reported.

comment:3 Changed on 04/10/20 at 20:15:16 by Sebastian Huber

Component: adminunspecified
Milestone: 5.1Indefinite

comment:4 Changed on 07/19/22 at 07:29:23 by Sebastian Huber

Component: unspecifiedlib
Milestone: Indefinite6.1
Resolution: fixed
Status: assignedclosed

It is fixed for RTEMS 6.1 through updates from the dtc upstream. Fixing this in RTEMS 5 would require back porting several patches.

Note: See TracTickets for help on using tickets.