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;