On Wed, May 13, 2020 at 10:52 PM Michael Ellerman <m...@ellerman.id.au> wrote: > > Jordan Niethe <jniet...@gmail.com> writes: > > diff --git a/arch/powerpc/lib/inst.c b/arch/powerpc/lib/inst.c > > new file mode 100644 > > index 000000000000..eaf786afad2b > > --- /dev/null > > +++ b/arch/powerpc/lib/inst.c > > @@ -0,0 +1,18 @@ > > +// 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 *nip) > > +{ > > + unsigned int val; > > + int err; > > + > > + err = probe_user_read(&val, nip, sizeof(val)); > > + *inst = ppc_inst(val); > > We shouldn't be storing to *inst if the read failed? Good point. > > I changed it to: > > + if (!err) > + *inst = ppc_inst(val); > + > > Similarly for probe_kernel_read_inst(). Thanks. > > cheers
- [PATCH v8 09/30] powerpc: Use a function for byte swappin... Jordan Niethe
- [PATCH v8 10/30] powerpc: Introduce functions for instruc... Jordan Niethe
- [PATCH v8 11/30] powerpc: Use a datatype for instructions Jordan Niethe
- Re: [PATCH v8 11/30] powerpc: Use a datatype for ins... Jordan Niethe
- Re: [PATCH v8 11/30] powerpc: Use a datatype for... Christophe Leroy
- Re: [PATCH v8 11/30] powerpc: Use a datatype... Jordan Niethe
- Re: [PATCH v8 11/30] powerpc: Use a datatype for ins... Jordan Niethe
- [PATCH v8 12/30] powerpc: Use a function for reading inst... Jordan Niethe
- [PATCH v8 13/30] powerpc: Add a probe_user_read_inst() fu... Jordan Niethe
- Re: [PATCH v8 13/30] powerpc: Add a probe_user_read_... Michael Ellerman
- Re: [PATCH v8 13/30] powerpc: Add a probe_user_r... Jordan Niethe
- Re: [PATCH v8 13/30] powerpc: Add a probe_user_read_... Christophe Leroy
- Re: [PATCH v8 13/30] powerpc: Add a probe_user_r... Jordan Niethe
- [PATCH v8 14/30] powerpc: Add a probe_kernel_read_inst() ... Jordan Niethe
- [PATCH v8 15/30] powerpc/kprobes: Use patch_instruction() Jordan Niethe
- [PATCH v8 16/30] powerpc: Define and use __get_user_instr... Jordan Niethe
- Re: [PATCH v8 16/30] powerpc: Define and use __get_u... Michael Ellerman
- Re: [PATCH v8 16/30] powerpc: Define and use __g... Jordan Niethe
- Re: [PATCH v8 16/30] powerpc: Define and use... Jordan Niethe
- [PATCH v8 17/30] powerpc: Introduce a function for report... Jordan Niethe
- [PATCH v8 18/30] powerpc/xmon: Use a function for reading... Jordan Niethe