Skip to content

Commit 4e4e930

Browse files
brooniectmarinas
authored andcommitted
arm64/signal: Make interface for restore_fpsimd_context() consistent
Instead of taking a pointer to struct user_ctxs like the other two restore_blah_context() functions the FPSIMD function takes a pointer to the user struct it should read. Change it to be consistent with the rest, both for consistency and to prepare for changes which avoid rereading data that has already been read by the core parsing code. There should be no functional change from this patch. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 0eb2372 commit 4e4e930

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

arch/arm64/kernel/signal.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ static void __user *apply_user_offset(
170170
return base + offset;
171171
}
172172

173+
struct user_ctxs {
174+
struct fpsimd_context __user *fpsimd;
175+
struct sve_context __user *sve;
176+
struct tpidr2_context __user *tpidr2;
177+
struct za_context __user *za;
178+
struct zt_context __user *zt;
179+
};
180+
173181
static int preserve_fpsimd_context(struct fpsimd_context __user *ctx)
174182
{
175183
struct user_fpsimd_state const *fpsimd =
@@ -188,24 +196,24 @@ static int preserve_fpsimd_context(struct fpsimd_context __user *ctx)
188196
return err ? -EFAULT : 0;
189197
}
190198

191-
static int restore_fpsimd_context(struct fpsimd_context __user *ctx)
199+
static int restore_fpsimd_context(struct user_ctxs *user)
192200
{
193201
struct user_fpsimd_state fpsimd;
194202
__u32 size;
195203
int err = 0;
196204

197205
/* check the size information */
198-
__get_user_error(size, &ctx->head.size, err);
206+
__get_user_error(size, &user->fpsimd->head.size, err);
199207
if (err)
200208
return -EFAULT;
201209
if (size != sizeof(struct fpsimd_context))
202210
return -EINVAL;
203211

204212
/* copy the FP and status/control registers */
205-
err = __copy_from_user(fpsimd.vregs, ctx->vregs,
213+
err = __copy_from_user(fpsimd.vregs, &(user->fpsimd->vregs),
206214
sizeof(fpsimd.vregs));
207-
__get_user_error(fpsimd.fpsr, &ctx->fpsr, err);
208-
__get_user_error(fpsimd.fpcr, &ctx->fpcr, err);
215+
__get_user_error(fpsimd.fpsr, &(user->fpsimd->fpsr), err);
216+
__get_user_error(fpsimd.fpcr, &(user->fpsimd->fpcr), err);
209217

210218
clear_thread_flag(TIF_SVE);
211219
current->thread.fp_type = FP_STATE_FPSIMD;
@@ -218,14 +226,6 @@ static int restore_fpsimd_context(struct fpsimd_context __user *ctx)
218226
}
219227

220228

221-
struct user_ctxs {
222-
struct fpsimd_context __user *fpsimd;
223-
struct sve_context __user *sve;
224-
struct tpidr2_context __user *tpidr2;
225-
struct za_context __user *za;
226-
struct zt_context __user *zt;
227-
};
228-
229229
#ifdef CONFIG_ARM64_SVE
230230

231231
static int preserve_sve_context(struct sve_context __user *ctx)
@@ -789,7 +789,7 @@ static int restore_sigframe(struct pt_regs *regs,
789789
if (user.sve)
790790
err = restore_sve_fpsimd_context(&user);
791791
else
792-
err = restore_fpsimd_context(user.fpsimd);
792+
err = restore_fpsimd_context(&user);
793793
}
794794

795795
if (err == 0 && system_supports_sme() && user.tpidr2)

0 commit comments

Comments
 (0)