Re: [PATCH 22/41] sparc: switch to ->get2()
From: Al Viro
Date: Tue Jun 30 2020 - 09:16:58 EST
On Mon, Jun 29, 2020 at 07:26:09PM +0100, Al Viro wrote:
> static int getregs64_get(struct task_struct *target,
> const struct user_regset *regset,
> - unsigned int pos, unsigned int count,
> - void *kbuf, void __user *ubuf)
> + struct membuf to)
> {
> const struct pt_regs *regs = task_pt_regs(target);
> - int ret;
>
> if (target == current)
> flushw_user();
>
> - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> - regs->u_regs + 1,
> - 0, 15 * sizeof(u64));
> - if (!ret)
> - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
> - 15 * sizeof(u64), 16 * sizeof(u64));
> - if (!ret) {
> - /* TSTATE, TPC, TNPC */
> - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> - ®s->tstate,
> - 16 * sizeof(u64),
> - 19 * sizeof(u64));
> - }
> - if (!ret) {
> - unsigned long y = regs->y;
> -
> - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> - &y,
> - 19 * sizeof(u64),
> - 20 * sizeof(u64));
> - }
> - return ret;
> + membuf_write(&to, regs->u_regs + 1, 15 * sizeof(u64));
> + return membuf_store(&to, (u64)0);
^^^^^^
Er... That should be simply
+ membuf_store(&to, (u64)0);
> + membuf_write(&to, ®s->tstate, 3 * sizeof(u64));
> + return membuf_store(&to, (u64)regs->y);
> }