On Tue, Sep 15, 2020 at 05:52:17PM +0200, Christoph Hellwig wrote: > 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. Yes, I'll check how the result looks like, and will probably change that. > Also any good reason for the __copy_from_user instead of the normal > copy_from_user here? I don't see any reason. If I remember correctly the only difference is zero padding, and that wouldn't hurt at all here. Will check and change. Thank you for taking a look!