[rtems commit] grtc.c: Fix Dereference before null check (CID #1399840)
Joel Sherrill
joel at rtems.org
Fri Feb 19 20:06:08 UTC 2021
Module: rtems
Branch: master
Commit: 1fd56a96fcfb90ceae5eff2598a5ca375ff85109
Changeset: http://git.rtems.org/rtems/commit/?id=1fd56a96fcfb90ceae5eff2598a5ca375ff85109
Author: Ryan Long <ryan.long at oarcorp.com>
Date: Tue Feb 16 17:15:01 2021 -0500
grtc.c: Fix Dereference before null check (CID #1399840)
CID 1399840: Dereference before null check in grtc_ioctl().
Closes #4252
---
bsps/shared/grlib/tmtc/grtc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bsps/shared/grlib/tmtc/grtc.c b/bsps/shared/grlib/tmtc/grtc.c
index 44e9685..e9acea4 100644
--- a/bsps/shared/grlib/tmtc/grtc.c
+++ b/bsps/shared/grlib/tmtc/grtc.c
@@ -1532,7 +1532,7 @@ static rtems_device_driver grtc_ioctl(rtems_device_major_number major, rtems_dev
struct grtc_priv *pDev;
struct drvmgr_dev *dev;
rtems_libio_ioctl_args_t *ioarg = (rtems_libio_ioctl_args_t *)arg;
- unsigned int *data = ioarg->buffer;
+ unsigned int *data;
int status,frm_len,i,ret;
struct grtc_ioc_buf_params *buf_arg;
struct grtc_ioc_config *cfg;
@@ -1556,6 +1556,8 @@ static rtems_device_driver grtc_ioctl(rtems_device_major_number major, rtems_dev
if (!ioarg)
return RTEMS_INVALID_NAME;
+ data = ioarg->buffer;
+
ioarg->ioctl_return = 0;
switch(ioarg->command) {
case GRTC_IOC_START:
More information about the vc
mailing list