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]
Date:   Mon, 15 Oct 2018 00:43:53 +0200
From:   Christian Brauner <christian@...uner.io>
To:     Alexey Dobriyan <adobriyan@...il.com>
CC:     linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
        longman@...hat.com
Subject: Re: [PATCH 1/2] sysctl: add overflow detection to proc_get_long()

On October 15, 2018 12:13:25 AM GMT+02:00, Alexey Dobriyan <adobriyan@...il.com> wrote:
>> > Yecchh...  First of all, the cast back to unsigned long long is
>completely
>> > pointless.  What's more,
>> 
>> Sorry, seriously asking: why?
>
>In C everything is casted to the same type before doing an operation,

Oh, ok that's what we're talking about. I 
thought the whole check is pointless. I 
didn't read careful enough apparently.

Tbh, even if the second cast is not 
necessary it makes implicit behavior
explicit.
I've also seen this form more than
the one without the explicit cast.
But I won't fight it. If other people
prefer it without the second cast; fine.

>in this case comparison
>
>> This was meant to handle the case where
>> sizeof(unsigned long long) != sizeof(unsigned long) and I just looked
>at
>> _kstrtoul() which does the same:
>
>Second cast is unnecessary. I don't remember why I did 2 casts.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ