taint: convert to indexed initialization
This converts to using indexed initializers instead of comments, adds a comment on why the taint flags can't be an enum, and make sure that no one forgets to update the taint_flags when adding new bits. Link: http://lkml.kernel.org/r/1519084390-43867-2-git-send-email-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1f5bd05476
commit
47d4b263a2
|
@ -544,6 +544,7 @@ extern enum system_states {
|
|||
SYSTEM_RESTART,
|
||||
} system_state;
|
||||
|
||||
/* This cannot be an enum because some may be used in assembly source. */
|
||||
#define TAINT_PROPRIETARY_MODULE 0
|
||||
#define TAINT_FORCED_MODULE 1
|
||||
#define TAINT_CPU_OUT_OF_SPEC 2
|
||||
|
|
|
@ -308,23 +308,23 @@ EXPORT_SYMBOL(panic);
|
|||
* is being removed anyway.
|
||||
*/
|
||||
const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = {
|
||||
{ 'P', 'G', true }, /* TAINT_PROPRIETARY_MODULE */
|
||||
{ 'F', ' ', true }, /* TAINT_FORCED_MODULE */
|
||||
{ 'S', ' ', false }, /* TAINT_CPU_OUT_OF_SPEC */
|
||||
{ 'R', ' ', false }, /* TAINT_FORCED_RMMOD */
|
||||
{ 'M', ' ', false }, /* TAINT_MACHINE_CHECK */
|
||||
{ 'B', ' ', false }, /* TAINT_BAD_PAGE */
|
||||
{ 'U', ' ', false }, /* TAINT_USER */
|
||||
{ 'D', ' ', false }, /* TAINT_DIE */
|
||||
{ 'A', ' ', false }, /* TAINT_OVERRIDDEN_ACPI_TABLE */
|
||||
{ 'W', ' ', false }, /* TAINT_WARN */
|
||||
{ 'C', ' ', true }, /* TAINT_CRAP */
|
||||
{ 'I', ' ', false }, /* TAINT_FIRMWARE_WORKAROUND */
|
||||
{ 'O', ' ', true }, /* TAINT_OOT_MODULE */
|
||||
{ 'E', ' ', true }, /* TAINT_UNSIGNED_MODULE */
|
||||
{ 'L', ' ', false }, /* TAINT_SOFTLOCKUP */
|
||||
{ 'K', ' ', true }, /* TAINT_LIVEPATCH */
|
||||
{ 'X', ' ', true }, /* TAINT_AUX */
|
||||
[ TAINT_PROPRIETARY_MODULE ] = { 'P', 'G', true },
|
||||
[ TAINT_FORCED_MODULE ] = { 'F', ' ', true },
|
||||
[ TAINT_CPU_OUT_OF_SPEC ] = { 'S', ' ', false },
|
||||
[ TAINT_FORCED_RMMOD ] = { 'R', ' ', false },
|
||||
[ TAINT_MACHINE_CHECK ] = { 'M', ' ', false },
|
||||
[ TAINT_BAD_PAGE ] = { 'B', ' ', false },
|
||||
[ TAINT_USER ] = { 'U', ' ', false },
|
||||
[ TAINT_DIE ] = { 'D', ' ', false },
|
||||
[ TAINT_OVERRIDDEN_ACPI_TABLE ] = { 'A', ' ', false },
|
||||
[ TAINT_WARN ] = { 'W', ' ', false },
|
||||
[ TAINT_CRAP ] = { 'C', ' ', true },
|
||||
[ TAINT_FIRMWARE_WORKAROUND ] = { 'I', ' ', false },
|
||||
[ TAINT_OOT_MODULE ] = { 'O', ' ', true },
|
||||
[ TAINT_UNSIGNED_MODULE ] = { 'E', ' ', true },
|
||||
[ TAINT_SOFTLOCKUP ] = { 'L', ' ', false },
|
||||
[ TAINT_LIVEPATCH ] = { 'K', ' ', true },
|
||||
[ TAINT_AUX ] = { 'X', ' ', true },
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -354,6 +354,8 @@ const char *print_tainted(void)
|
|||
{
|
||||
static char buf[TAINT_FLAGS_COUNT + sizeof("Tainted: ")];
|
||||
|
||||
BUILD_BUG_ON(ARRAY_SIZE(taint_flags) != TAINT_FLAGS_COUNT);
|
||||
|
||||
if (tainted_mask) {
|
||||
char *s;
|
||||
int i;
|
||||
|
|
Loading…
Reference in a new issue