summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2017-02-03 08:53:35 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2017-03-06 07:54:55 +0100
commitcc8a50ab5c307bcf939c7f346042a8fd66f4bf56 (patch)
tree2d7356e06f64cf178e0ceb760fc28eede85abb41
parentfec8288f51508791026a842faf98682256f16ecc (diff)
downloadrtems-cc8a50ab5c307bcf939c7f346042a8fd66f4bf56.tar.bz2
leon,grtm: ioctl() shouldn't access pointer before validated
This is a fix for a coverity warning
-rw-r--r--c/src/lib/libbsp/sparc/shared/tmtc/grtm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c b/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c
index 48b4631a52..a1038d4fd2 100644
--- a/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c
+++ b/c/src/lib/libbsp/sparc/shared/tmtc/grtm.c
@@ -1188,7 +1188,7 @@ static rtems_device_driver grtm_ioctl(rtems_device_major_number major, rtems_dev
struct grtm_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;
struct grtm_ioc_config *cfg;
struct grtm_ioc_hw_status *hwregs;
@@ -1209,6 +1209,7 @@ static rtems_device_driver grtm_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 GRTM_IOC_START: