On Sat, Jan 08, 2022 at 04:05:10PM +0200, Jarkko Sakkinen wrote: > +static inline pgoff_t sgx_encl_get_backing_pcmd_nr(struct sgx_encl *encl, pgoff_t index) > +{ > + return PFN_DOWN(encl->size) + 1 + (index / sizeof(struct sgx_pcmd)); > +} Found it. This should be static inline pgoff_t sgx_encl_get_backing_pcmd_nr(struct sgx_encl *encl, pgoff_t index) { return PFN_DOWN(encl->size) + 1 + (index * PAGE_SIZE) / sizeof(struct sgx_pcmd); } /Jarkko