Re: [PATCH v4] x86/sgx: Free backing memory after faulting the enclave page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/28/22 04:55, Jarkko Sakkinen wrote:
> I thought that the formula is so simple that it does not matter if it is
> just in two sites open coded but I can wrap it too, if required, e.g.
> 
> /* 
>  * Calculate byte offset of a PCMD struct associated to an enclave page.
>  * PCMD's follow right after the EPC data in the backing storage. In
>  * addition to the visible enclave pages, there's one extra page slot
>  * for SECS, before PCMD data.
>  */
> static pgoff_t *sgx_encl_page_index_to_pcmd_offset(struct sgx_encl *encl, unsigned long page_index)
> {
>         return encl->size + PAGE_SIZE + page_index * sizeof(struct sgx_pcmd);
> }

Yes, it's required.  Please wrap it.

There's also nothing wrong with spreading that calculation across
several lines.  It may be arithmetically simple, but it's combining
three or four logical steps.  There's no shame in separating and
commenting some of those separately.



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux