Skip to content

Commit

Permalink
Fix memory location checks
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph M. Wintersteiger <[email protected]>
  • Loading branch information
Christoph M. Wintersteiger committed Aug 7, 2020
1 parent f3ee2f2 commit f7d13f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/enclave/enclave_oe.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static void _copy_shared_memory(const sgxlkl_shared_memory_t* host)

enc->virtio_blk_dev_mem = oe_calloc_or_die(
enc->num_virtio_blk_dev,
sizeof(void*),
sizeof(struct virtio_dev*),
"Could not allocate memory for virtio block devices\n");
enc->virtio_blk_dev_names = oe_calloc_or_die(
enc->num_virtio_blk_dev,
Expand Down
4 changes: 2 additions & 2 deletions src/lkl/virtio_blkdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void lkl_deliver_irq(uint8_t dev_id)
struct virtio_dev** mems =
sgxlkl_enclave_state.shared_memory.virtio_blk_dev_mem;

if (!oe_is_outside_enclave(mems, sizeof(struct virtio_dev*)))
if (!oe_is_within_enclave(mems, sizeof(struct virtio_dev*)))
oe_abort();

struct virtio_dev* dev = mems[dev_id];
Expand Down Expand Up @@ -49,7 +49,7 @@ void lkl_add_disks(
struct virtio_dev** mems =
sgxlkl_enclave_state.shared_memory.virtio_blk_dev_mem;

if (!oe_is_outside_enclave(mems, sizeof(struct virtio_dev*)))
if (!oe_is_within_enclave(mems, sizeof(struct virtio_dev*)))
oe_abort();

struct virtio_dev* root_dev =
Expand Down

0 comments on commit f7d13f9

Please sign in to comment.