aboutsummaryrefslogtreecommitdiff
path: root/core/flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/flash.c')
-rw-r--r--core/flash.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/flash.c b/core/flash.c
index da435a0..6d384d4 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -387,12 +387,18 @@ err:
static int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf,
uint64_t size, uint64_t token)
{
+ if (!opal_addr_valid((void *)buf))
+ return OPAL_PARAMETER;
+
return opal_flash_op(FLASH_OP_READ, id, offset, buf, size, token);
}
static int64_t opal_flash_write(uint64_t id, uint64_t offset, uint64_t buf,
uint64_t size, uint64_t token)
{
+ if (!opal_addr_valid((void *)buf))
+ return OPAL_PARAMETER;
+
return opal_flash_op(FLASH_OP_WRITE, id, offset, buf, size, token);
}