#4280 closed defect (fixed)

gen_uuid.c: Unchecked return value from library errors spotted by Coverity

Reported by: Ryan Long Owned by: Ryan Long <ryan.long@…>
Priority: normal Milestone: 6.1
Component: lib Version: 6
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

CID 1049146: Unchecked return value from library in get_clock().
CID 1049147: Unchecked return value from library in get_random_fd().

CID 1049146

427                rewind(state_f);
428                fl.l_type = F_UNLCK;
   CID 1049146 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)18. check_return: Calling fcntl(state_fd, 8, &fl) without checking return value. This library function may fail and return an error code. [Note: The source code implementation of the function has been overridden by a builtin model.]
429                fcntl(state_fd, F_SETLK, &fl);
430        }
431
432        *clock_high = clock_reg >> 32;

CID 1049147

167                        if (i >= 0)
   CID 1049147 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)5. check_return: Calling fcntl(fd, 2, i | 1) without checking return value. This library function may fail and return an error code. [Note: The source code implementation of the function has been overridden by a builtin model.]
168                                fcntl(fd, F_SETFD, i | FD_CLOEXEC);
169                }

Change History (4)

comment:1 Changed on 03/08/21 at 20:56:17 by Ryan Long <ryan.long@…>

Owner: set to Ryan Long <ryan.long@…>
Resolution: fixed
Status: newclosed

In 597e4f4/rtems:

gen_uuid.c: Fix two Unchecked return value from library errors

CID 1049146: Unchecked return value from library in get_clock().
CID 1049147: Unchecked return value from library in get_random_fd().

Closes #4280

comment:2 Changed on 03/24/21 at 13:03:24 by Joel Sherrill <joel@…>

In 62bbb0c/rtems:

gen_uuid.c: Revert previous patch (597e4f476568a225d14dfaff02074cf269ad62ac)

The patch was:

gen_uuid.c: Fix two Unchecked return value from library errors

CID 1049146: Unchecked return value from library in get_clock().
CID 1049147: Unchecked return value from library in get_random_fd().

Reopen #4280

comment:3 Changed on 03/24/21 at 13:06:13 by Joel Sherrill

Resolution: fixed
Status: closedreopened

The fix was incorrect. It did not include the rtems assert.h header. Assuming the paths were testable, it would be checking return values on fcntl() commands that RTEMS does not support.

A more likely approach is to ifndef rtems the unsupported fcntl's and see how that goes.

It is unclear if there was communication with the upstream project which would have been needed.

comment:4 Changed on 05/28/21 at 17:29:41 by Ryan Long <ryan.long@…>

Resolution: fixed
Status: reopenedclosed

In a187b09/rtems:

gen_uuid.c: Ignore return values from fcntl()

CID 1049146: Unchecked return value from library in get_clock().
CID 1049147: Unchecked return value from library in get_random_fd().

Closes #4280

Note: See TracTickets for help on using tickets.