mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 23:23:13 +00:00
grtc.c: Fix Dereference before null check (CID #1399840)
CID 1399840: Dereference before null check in grtc_ioctl(). Closes #4252
This commit is contained in:
@@ -1532,7 +1532,7 @@ static rtems_device_driver grtc_ioctl(rtems_device_major_number major, rtems_dev
|
|||||||
struct grtc_priv *pDev;
|
struct grtc_priv *pDev;
|
||||||
struct drvmgr_dev *dev;
|
struct drvmgr_dev *dev;
|
||||||
rtems_libio_ioctl_args_t *ioarg = (rtems_libio_ioctl_args_t *)arg;
|
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;
|
int status,frm_len,i,ret;
|
||||||
struct grtc_ioc_buf_params *buf_arg;
|
struct grtc_ioc_buf_params *buf_arg;
|
||||||
struct grtc_ioc_config *cfg;
|
struct grtc_ioc_config *cfg;
|
||||||
@@ -1556,6 +1556,8 @@ static rtems_device_driver grtc_ioctl(rtems_device_major_number major, rtems_dev
|
|||||||
if (!ioarg)
|
if (!ioarg)
|
||||||
return RTEMS_INVALID_NAME;
|
return RTEMS_INVALID_NAME;
|
||||||
|
|
||||||
|
data = ioarg->buffer;
|
||||||
|
|
||||||
ioarg->ioctl_return = 0;
|
ioarg->ioctl_return = 0;
|
||||||
switch(ioarg->command) {
|
switch(ioarg->command) {
|
||||||
case GRTC_IOC_START:
|
case GRTC_IOC_START:
|
||||||
|
|||||||
Reference in New Issue
Block a user