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: <CA+55aFwu_KMU=-=gYNsy1ms1SsVjadXKwFD--qXm=ErmSM3ucA@mail.gmail.com>
Date:	Tue, 3 Jun 2014 09:30:42 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Dave Jones <davej@...hat.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Michael Kerrisk-manpages <mtk.manpages@...il.com>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: sched: Disallow sched_attr::sched_policy < 0

On Tue, Jun 3, 2014 at 1:08 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>
> Once upon a time GCC also did warns like that, but my compiler is silent
> :-(

You should be happy. The gcc warnings were shit.

Iirc, gcc literally at one point warned about things like

   unsigned int i;

   if (i < 5)

because that's comparing an unsigned type ("i") with an expression
having a signed type ("5"). Yes, technically true, but it's not
actually a useful warning.

That got fixed pretty quickly, but I think gcc *still* warns about things like

    unsigned int i;

    if (i >= 0 && i <= 6)
        ...

which is actually a very valid thing to do, and is commonly the result
of using a range-checking macro, or in general writing code so that it
is robust and doesn't care about the actual underlying type.

Warnings about robust code are f*cking broken, and easily worse than
not having the warning at all. Because it results in people removing
the range check.

Btw, -Wsign-compare still complains about

   int i;

   if (i < 0 || i > sizeof(i))
       return error;

which is another example of a f*cking broken warning. There is no way
to avoid that warning without making the code worse. That code is
_correct_, dammit, and anybody who thinks it should warn (or the
programmer should cast the sizeof to "int") is a tool and a moron.

End result: disabling "-Wsign-compare" is thus the only correct thing
to do. Sadly compiler writers don't seem to care too deeply about the
sanity of their warnings.

              Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ