lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <10ce2343-7fab-8cf8-488b-9768dbc8889a@c-s.fr>
Date:   Fri, 24 Apr 2020 07:48:34 +0200
From:   Christophe Leroy <christophe.leroy@....fr>
To:     Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Cc:     mpe@...erman.id.au, mikey@...ling.org, apopple@...ux.ibm.com,
        paulus@...ba.org, npiggin@...il.com,
        naveen.n.rao@...ux.vnet.ibm.com, peterz@...radead.org,
        jolsa@...nel.org, oleg@...hat.com, fweisbec@...il.com,
        mingo@...nel.org, linuxppc-dev@...ts.ozlabs.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 13/16] powerpc/watchpoint: Prepare handler to handle
 more than one watcnhpoint

Hi Ravi,

Le 24/04/2020 à 05:32, Ravi Bangoria a écrit :
> Hi Christophe,
> 
>>> @@ -101,14 +129,20 @@ static bool is_ptrace_bp(struct perf_event *bp)
>>>    */
>>>   void arch_unregister_hw_breakpoint(struct perf_event *bp)
>>>   {
>>> +    int i;
>>> +
>>
>> This declaration should be in the block using it.
>>
>>>       /*
>>>        * If the breakpoint is unregistered between a 
>>> hw_breakpoint_handler()
>>>        * and the single_step_dabr_instruction(), then cleanup the 
>>> breakpoint
>>>        * restoration variables to prevent dangling pointers.
>>>        * FIXME, this should not be using bp->ctx at all! Sayeth peterz.
>>>        */
>>> -    if (bp->ctx && bp->ctx->task && bp->ctx->task != ((void *)-1L))
>>> -        bp->ctx->task->thread.last_hit_ubp = NULL;
>>> +    if (bp->ctx && bp->ctx->task && bp->ctx->task != ((void *)-1L)) {
>>
>> Add declaration of 'int i' here.
> 
> How will that help? Keeping declaration at the start of function is also
> common practice and I don't see any recommendation to move them inside
> conditional block.

Reducing the scope of local variables increases readability, you don't 
have to scroll all up to the top of the function to see the declaration 
of the variable.

common practice ? Are you sure ? Just have a look at fs/io_uring.c or 
many other files in the kernel to see how uncommon your practice is.

Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ