summaryrefslogtreecommitdiffstats
path: root/bsps/shared/grlib
diff options
context:
space:
mode:
authorRyan Long <ryan.long@oarcorp.com>2021-02-16 16:20:04 -0500
committerJoel Sherrill <joel@rtems.org>2021-02-19 14:05:49 -0600
commiteff3d7c05f71a60e93a67b08168f5f64b747c56d (patch)
tree584d60a93f721cb601a33b2f0e47b53c9a47d16a /bsps/shared/grlib
parentrtems: Generate <rtems/rtems/signal.h> (diff)
downloadrtems-eff3d7c05f71a60e93a67b08168f5f64b747c56d.tar.bz2
b1553brm.c: Fix Dereference before null check (CID #1399829)
CID 1399829: Dereference before null check in brm_control(). Closes #4250
Diffstat (limited to 'bsps/shared/grlib')
-rw-r--r--bsps/shared/grlib/1553/b1553brm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bsps/shared/grlib/1553/b1553brm.c b/bsps/shared/grlib/1553/b1553brm.c
index 57ef70126b..694f5850f2 100644
--- a/bsps/shared/grlib/1553/b1553brm.c
+++ b/bsps/shared/grlib/1553/b1553brm.c
@@ -994,8 +994,8 @@ static rtems_device_driver brm_control(rtems_device_major_number major, rtems_de
unsigned int i=0;
unsigned short ctrl, oper, cw1, cw2;
rtems_libio_ioctl_args_t *ioarg = (rtems_libio_ioctl_args_t *) arg;
- unsigned int *data = ioarg->buffer;
- struct bc_msg *cmd_list = (struct bc_msg *) ioarg->buffer;
+ unsigned int *data;
+ struct bc_msg *cmd_list;
brm_priv *brm;
struct drvmgr_dev *dev;
rtems_device_driver ret;
@@ -1013,6 +1013,9 @@ static rtems_device_driver brm_control(rtems_device_major_number major, rtems_de
return RTEMS_INVALID_NAME;
}
+ data = ioarg->buffer;
+ cmd_list = (struct bc_msg *) ioarg->buffer;
+
ioarg->ioctl_return = 0;
switch (ioarg->command) {