[RTEMS Project] #4250: b1553brm.c: Dereference before null check error spotted by Coverity

RTEMS trac trac at rtems.org
Tue Feb 16 20:43:31 UTC 2021


#4250: b1553brm.c: Dereference before null check error spotted by Coverity
------------------------+--------------------
  Reporter:  Ryan Long  |      Owner:  (none)
      Type:  defect     |     Status:  new
  Priority:  normal     |  Milestone:  6.1
 Component:  bsps       |    Version:  6
  Severity:  normal     |   Keywords:
Blocked By:             |   Blocking:
------------------------+--------------------
 CID 1399829: Dereference before null check in brm_control().

 {{{
 rtems_libio_ioctl_args_t *ioarg = (rtems_libio_ioctl_args_t *) arg;
     deref_ptr: Directly dereferencing pointer ioarg.
  997        unsigned int *data = ioarg->buffer;
  998        struct bc_msg *cmd_list = (struct bc_msg *) ioarg->buffer;
  999        brm_priv *brm;
 1000        struct drvmgr_dev *dev;
 1001        rtems_device_driver ret;
 1002        int len, msglen;
 1003
 1004        FUNCDBG("brm_control[%d]: [%i,%i]\n", minor, major, minor);
 1005
 1006        if ( drvmgr_get_dev(&b1553brm_drv_info.general, minor, &dev) )
 {
 1007                return RTEMS_UNSATISFIED;
 1008        }
 1009        brm = (brm_priv *)dev->priv;
 1010
     CID 1399829 (#1 of 1): Dereference before null check
 (REVERSE_INULL)check_after_deref: Null-checking ioarg suggests that it may
 be null, but it has already been dereferenced on all paths leading to the
 check.
 1011        if (!ioarg) {
 }}}

--
Ticket URL: <http://devel.rtems.org/ticket/4250>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list