aboutsummaryrefslogtreecommitdiff
path: root/hal_io_eim.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-04 23:23:07 -0400
committerRob Austein <sra@hactrn.net>2015-10-04 23:23:07 -0400
commitff4ff7c8ccf0c5d5c1c363053f0fc84ec5674edf (patch)
treea056a1f82fca48e6e38d58180e82fe1ad71fb29c /hal_io_eim.c
parentc48caf83239f971edf17c978ef7d0987e3aaa718 (diff)
Disallow NULL core argument in lowest-level HAL I/O routines.
Diffstat (limited to 'hal_io_eim.c')
-rw-r--r--hal_io_eim.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hal_io_eim.c b/hal_io_eim.c
index 4f9df65..7d2e32a 100644
--- a/hal_io_eim.c
+++ b/hal_io_eim.c
@@ -98,6 +98,9 @@ hal_error_t hal_io_write(const hal_core_t *core, hal_addr_t offset, const uint8_
{
hal_error_t err;
+ if (core == NULL)
+ return HAL_ERROR_CORE_NOT_FOUND;
+
if (len % 4 != 0)
return HAL_ERROR_IO_BAD_COUNT;
@@ -122,6 +125,9 @@ hal_error_t hal_io_read(const hal_core_t *core, hal_addr_t offset, uint8_t *buf,
int rlen = len;
hal_error_t err;
+ if (core == NULL)
+ return HAL_ERROR_CORE_NOT_FOUND;
+
if (len % 4 != 0)
return HAL_ERROR_IO_BAD_COUNT;