]> git.baikalelectronics.ru Git - kernel.git/commit
checkpatch: warn on usage of VM_BUG_ON() and other BUG variants
authorDavid Hildenbrand <david@redhat.com>
Fri, 23 Sep 2022 11:34:25 +0000 (13:34 +0200)
committerJonathan Corbet <corbet@lwn.net>
Thu, 29 Sep 2022 19:20:53 +0000 (13:20 -0600)
commit67f74b2cb568554e2f24b85bd5704464fed84387
tree86d52da45f0ef03171422a8fe18cbe5466642d74
parent0104097118172475b87fd1e91d4a3b9091fa83ad
checkpatch: warn on usage of VM_BUG_ON() and other BUG variants

checkpatch does not point out that VM_BUG_ON() and friends should be
avoided, however, Linus notes:

    VM_BUG_ON() has the exact same semantics as BUG_ON. It is literally
    no different, the only difference is "we can make the code smaller
    because these are less important". [1]

So let's warn on VM_BUG_ON() and other BUG variants as well. While at it,
make it clearer that the kernel really shouldn't be crashed.

As there are some subsystem BUG macros that actually don't end up crashing
the kernel -- for example, KVM_BUG_ON() -- exclude these manually.

[1] https://lore.kernel.org/r/CAHk-=wg40EAZofO16Eviaj7mfqDhZ2gVEbvfsMf6gYzspRjYvw@mail.gmail.com

Signed-off-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20220923113426.52871-3-david@redhat.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
scripts/checkpatch.pl