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: <045C79AE-8A15-4287-8788-BF84AC6BA382@lca.pw>
Date:   Thu, 18 Jul 2019 16:44:42 -0400
From:   Qian Cai <cai@....pw>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...hat.com, Valentin Schneider <valentin.schneider@....com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] sched/core: silence a warning in sched_init()



> On Jun 25, 2019, at 11:57 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> 
> On Tue, Jun 25, 2019 at 11:07:09AM -0400, Qian Cai wrote:
>> On Tue, 2019-06-25 at 16:25 +0200, Peter Zijlstra wrote:
>>> On Tue, Jun 25, 2019 at 10:04:19AM -0400, Qian Cai wrote:
>>>> On Tue, 2019-06-25 at 15:52 +0200, Peter Zijlstra wrote:
>>>> Yes, -Wmissing-prototype makes no sense, but "-Wunused-but-set-variable" is
>>>> pretty valid to catch certain developer errors. For example,
>>>> 
>>>> https://lists.linuxfoundation.org/pipermail/iommu/2019-May/035680.html
>>>> 
>>>>> 
>>>>> As to this one, ideally the compiler would not be stupid, and understand
>>>>> the below, but alas.
>>>> 
>>>> Pretty sure that won't work, as the compiler will complain something like,
>>>> 
>>>> ISO C90 forbids mixed declarations and code
>>> 
>>> No, it builds just fine, it's a new block and C allows new variables at
>>> every block start -- with the scope of that block.
>> 
>> I remember I tried that before but recalled the error code wrong. Here it is,
>> 
>> kernel/sched/core.c:5940:17: warning: unused variable 'ptr' [-Wunused-variable]
>>                 unsigned long ptr = (unsigned long)kzalloc(alloc_size,
>> GFP_NOWAIT);
> 
> Yes, I know, I tried. And GCC is a moron because of it.

Actually, not only GCC but clang also don’t understand your patch.

# make CC=clang W=1 kernel/sched/core.o

kernel/sched/core.c:6384:17: warning: unused variable 'ptr' [-Wunused-variable]
                unsigned long ptr = (unsigned long)kzalloc(alloc_size, GFP_NOWAIT);

Maybe adding a “__maybe_unused” until the day that compilers are getting smarter. 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ