[PATCH] powerpc/kprobes: refactor kprobe_lookup_name for safer string operations

Michael Ellerman mpe at ellerman.id.au
Thu Apr 27 21:31:50 AEST 2017


"Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> writes:
> Excerpts from Masami Hiramatsu's message of April 26, 2017 10:11:
>> On Tue, 25 Apr 2017 21:37:11 +0530
>> "Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> wrote:
>>> -	addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name);
>>> -	if (!addr && dot_appended) {
>>> -		/* Let's try the original non-dot symbol lookup	*/
>>> +	ret = strscpy(dot_name + len, c, KSYM_NAME_LEN);
>>> +	if (ret >= 0)
>> 
>> Here, maybe you can skip the case of ret == 0. (Or, would we have
>> a symbol which only has "."?)
>
> Ah, indeed. Good point. We just need the test to be (ret > 0).
>
> Michael,
> If the rest of the patch is fine by you, would you be ok to make the 
> small change above? If not, please let me know and I'll re-spin. Thanks.

I'd rather you change it, test and then resend.

cheers


More information about the Linuxppc-dev mailing list