lkml.org 
[lkml]   [2019]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [GIT pull] x86/urgent for 5.3-rc5
On Mon, Aug 26, 2019 at 5:53 AM Borislav Petkov <bp@suse.de> wrote:
>
> + if (!changed) {
> + pr_emerg(
> +"RDRAND gives funky smelling output, might consider not using it by booting with \"nordrand\"");
> + WARN_ON_ONCE(1);
> + }

Side note: I'd suggest

if (WARN_ON_ONCE(!changed))
pr_emerg("RDRAND gives funky smelling output, might
consider not using it by booting with \"nordrand\"");

instead.

Note that WARN_ON_ONCE() will only _warn_ once, but it always returns
the conditional.

So it's equivalent to your version ("always print, warn once") except for:

(a) smaller
(b) different order of warning and pr_emerg()
(c) the WARN_ON_ONCE() also contains the proper "unlikely()", so it
generates better code

and I just try to encourage people to use that "if (WARN_ON())" format
for these kinds of "shouldn't happen, so warn and then do something".

Although usually the "do something" is just "return and refuse to do
anything further" rather than the additional printk.

Linus

\
 
 \ /
  Last update: 2019-08-27 18:56    [W:0.077 / U:2.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site