On Wed, Jun 15, 2022 at 06:11:03AM -0700, Christoph Hellwig wrote: > On Tue, Jun 14, 2022 at 03:39:32PM +0900, Hyeonggon Yoo wrote: > > + > > + if (WARN((IS_ENABLED(CONFIG_EFI) ? cpa->pgd != efi_mm.pgd : true) > > + && address <= TASK_SIZE_MAX, > > + KERN_WARNING "CPA: Got a user address")) > > + return -EINVAL; > > This looks rather unreadable. > > Why not something like: > > static bool cpa_addr_valid(struct cpa_data *cpa, unsigned long address) > { > if (address > TASK_SIZE_MAX) > return true; > if (IS_ENABLED(CONFIG_EFI) && cpa->pgd == efi_mm.pgd) > return true; > return false; > } > > .... > > if (WARN_ON_ONCE(!cpa_addr_valid(cpa, address))) > return -EINVAL; > Thank your for feedback. I'll care more about readability in v2. -- Thanks, Hyeonggon