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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 20 May 2020 10:39:33 +0200
From:   Antonio Quartulli <a@...table.cc>
To:     David Miller <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, cake@...ts.bufferbloat.net, toke@...e.dk,
        jhs@...atatu.com, xiyou.wangcong@...il.com, jiri@...nulli.us,
        stephen@...workplumber.org
Subject: Re: [PATCH] net/sch_generic.h: use sizeof_member() and get rid of
 unused variable

Hi David,

On 20/05/2020 00:40, David Miller wrote:
> From: Antonio Quartulli <a@...table.cc>
> Date: Tue, 19 May 2020 11:13:33 +0200
> 
>> Compiling with -Wunused triggers the following warning:
>>
>> ./include/net/sch_generic.h: In function ‘qdisc_cb_private_validate’:
>> ./include/net/sch_generic.h:464:23: warning: unused variable ‘qcb’ [-Wunused-variable]
>>   464 |  struct qdisc_skb_cb *qcb;
>>       |                       ^~~
>>
>> as the qcb variable is only used to compute the sizeof one of its members.
> 
> It's referenced in the code, therefore it is not "unused".

True.

> 
> If in some configuration BUILD_BUG_ON() does not reference it's arguments,
> that's the bug that needs to be fixed.
> 

I don't think it's BUILD_BUG_ON()'s fault, because qcb->data is passed
to sizeof() first.

My best guess is that gcc is somewhat optimizing the sizeof(gcb->data)
and thus leaving the gcb variable unused.


This said, I think it's better for the code style (and for the compiler)
if we used sizeof_member().

Should I resend the patch with a commit message that does not mention
the "unused" warning?


Thanks a lot.
Best Regards,


-- 
Antonio Quartulli

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ