> +static inline struct sgx_epc_lru_lists *epc_cg_lru(struct sgx_epc_cgroup > *epc_cg) > +{ > + if (epc_cg) > + return &epc_cg->lru; > + return NULL; > +} >
It's legal to return NULL EPC cgroup for a given EPC page, i.e., when the enclave isn't assigned to any cgroup. But ... > > static inline struct sgx_epc_lru_lists *sgx_lru_lists(struct sgx_epc_page > *epc_page) > { > + if (IS_ENABLED(CONFIG_CGROUP_SGX_EPC)) > + return epc_cg_lru(epc_page->epc_cg); > + > return &sgx_global_lru; > } ... here is it legal to return a NULL LRU list? It appears you always want to return a valid LRU list. That is, if EPC cgroup is enabled, and when the EPC page doesn't belong to any cgroup, then you want to return the sgx_global_lru ?