Re: [PATCH v2 22/24] ptrace: cleanup arch_ptrace() on tile

From: Namhyung Kim
Date: Thu Sep 02 2010 - 12:55:37 EST


Hello,

On Fri, Sep 3, 2010 at 01:35, Chris Metcalf <cmetcalf@xxxxxxxxxx> wrote:
>  On 9/2/2010 11:46 AM, Namhyung Kim wrote:
>> Remove checking @addr less than 0 because @addr is now unsigned.
>>
>> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
>> Cc: Chris Metcalf <cmetcalf@xxxxxxxxxx>
>> ---
>>  arch/tile/kernel/ptrace.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
>> index aed9256..704bf11 100644
>> --- a/arch/tile/kernel/ptrace.c
>> +++ b/arch/tile/kernel/ptrace.c
>> @@ -85,7 +85,7 @@ long arch_ptrace(struct task_struct *child, long request,
>>       case PTRACE_PEEKUSR:  /* Read register from pt_regs. */
>>               if (addr & (sizeof(data)-1))
>>                       break;
>> -             if (addr < 0 || addr >= PTREGS_SIZE)
>> +             if (addr >= PTREGS_SIZE)
>>                       break;
>>               tmp = getreg(child, addr);   /* Read register */
>>               ret = put_user(tmp, datap);
>> @@ -94,7 +94,7 @@ long arch_ptrace(struct task_struct *child, long request,
>>       case PTRACE_POKEUSR:  /* Write register in pt_regs. */
>>               if (addr & (sizeof(data)-1))
>>                       break;
>> -             if (addr < 0 || addr >= PTREGS_SIZE)
>> +             if (addr >= PTREGS_SIZE)
>>                       break;
>>               putreg(child, addr, data);   /* Write register */
>>               ret = 0;
>
> This omits the change to the actual function definition, which was present
> in the previous version of this patch.
>

That change was moved/combined into previous patch in this series.
Please check out 03/24 in this patchset also.


> On the up side, it also removes the change to the sizeof() values in
> GETREGS/SETREGS, which seemed unnecessary in the previous version.
>

Yes, it is unnecessary but little bit more accurate although there will be no
machine that has diferent size of long and unsigned long. Anyway if you
really hate it, I'll discard it. :-)


--
Regards,
Namhyung Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/