mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

Introduce a probe_user_read_inst() function to use in cases where probe_user_read() is used for getting an instruction. This will be more useful for prefixed instructions. Signed-off-by: Jordan Niethe <jniethe5@gmail.com> Reviewed-by: Alistair Popple <alistair@popple.id.au> [mpe: Don't write to *inst on error, fold in __user annotations] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200506034050.24806-14-jniethe5@gmail.com
20 lines
353 B
C
20 lines
353 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright 2020, IBM Corporation.
|
|
*/
|
|
|
|
#include <linux/uaccess.h>
|
|
#include <asm/inst.h>
|
|
|
|
int probe_user_read_inst(struct ppc_inst *inst,
|
|
struct ppc_inst __user *nip)
|
|
{
|
|
unsigned int val;
|
|
int err;
|
|
|
|
err = probe_user_read(&val, nip, sizeof(val));
|
|
if (!err)
|
|
*inst = ppc_inst(val);
|
|
|
|
return err;
|
|
}
|