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: <bce8cc03-0aba-3915-de98-cdf1c9d183f2@gmail.com>
Date:   Mon, 22 Nov 2021 18:19:18 +0100
From:   "Alejandro Colomar (man-pages)" <alx.manpages@...il.com>
To:     Edward Cree <ecree.xilinx@...il.com>, netdev@...r.kernel.org
Cc:     Martin Habets <habetsm.xilinx@...il.com>
Subject: Re: [PATCH] drivers/net/ethernet/sfc/: Simplify code

Hi Edward,

On 11/22/21 17:17, Edward Cree wrote:
> On 20/11/2021 20:14, Alejandro Colomar wrote:
>> That ternary operator has
>> the same exact code in both of the branches.
>>
>> Unless there's some hidden magic in the condition,
>> there's no reason for it to be,
>> and it can be replaced
>> by the code in one of the branches.
>>
>> That code has been untouched since it was added,
>> so there's no information in git about
>> why it was written that way.
>>
>> Signed-off-by: Alejandro Colomar <alx.manpages@...il.com>
>> Cc: Edward Cree <ecree.xilinx@...il.com>
>> Cc: Martin Habets <habetsm.xilinx@...il.com>
>> Cc: netdev@...r.kernel.org
> 
> I guess it's there for type-checking — essentially as an assert that
>   field_type == typeof(efx_##source_name.field).  Probably when it was
>   added there was no standard way to do this; now we could probably
>   use <linux/typecheck.h> or some such.
> The comment just above the macro does mention "with type-checking".

Yes, that's why I suggested there was probably some black magic 
involved.  But I couldn't read it, though.

I suggest replacing it with a static_assert(__same_type()) thingy.

Cheers,
Alex


-- 
Alejandro Colomar
Linux man-pages comaintainer; http://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ