On Tue, Sep 15, 2020 at 05:43:38PM +0200, Heiko Carstens wrote: > + if (user_mode(regs)) { > + if (__copy_from_user(code + start - 2, (char __user *)addr, 2)) > + break; > + } else { > + if (copy_from_kernel_nofault(code + start - 2, (char *)addr, 2)) > + break; > + } > for (end = 32; end < 64; end += 2) { > addr = regs->psw.addr + end - 32; > + if (user_mode(regs)) { > + if (__copy_from_user(code + end, (char __user *)addr, 2)) > + break; > + } else { > + if (copy_from_kernel_nofault(code + end, (char *)addr, 2)) > + break; > + } Maybe add a little copy_from_regs helper? That would also get rid of the awfully long lines here. Also any good reason for the __copy_from_user instead of the normal copy_from_user here?