Re: [PATCH 12/14] selftests/sgx: Add page permission and exception test

From: Reinette Chatre
Date: Thu Sep 16 2021 - 11:37:44 EST


Hi Jarkko,

On 9/16/2021 8:21 AM, Jarkko Sakkinen wrote:
On Wed, 2021-09-15 at 13:31 -0700, Reinette Chatre wrote:

...

+/*
+ * Return the offset in the enclave where the data segment can be found.
+ * The first RW segment loaded is the TCS, skip that to get info on the
+ * data segment.
+ */
+static off_t encl_get_data_offset(struct encl *encl)
+{
+ int i;
+
+ for (i = 0; i < encl->nr_segments; i++) {
+ struct encl_segment *seg = &encl->segment_tbl[i];
+
+ if (i != 0 && seg->prot == (PROT_READ | PROT_WRITE))
+ return seg->offset;

So, why not

for (i = 1; i < encl->nr_segments; i++)

?

Thank you for catching this. Will do.

Reinette