Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

error: implicit declaration of function 'module_flags_taint'

Recent changes to kernel/module.c caused the following compile
error:

kernel/module.c: In function ‘show_taint’:
kernel/module.c:1024:2: error: implicit declaration of function ‘module_flags_taint’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

Correct this error by moving the definition of module_flags_taint
outside of the #ifdef CONFIG_MODULE_UNLOAD section.

Signed-off-by: Kevin Winchester <kjwinchester@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Kevin Winchester and committed by
Linus Torvalds
53999bf3 122804ec

+20 -20
+20 -20
kernel/module.c
··· 842 842 return ret; 843 843 } 844 844 845 - static size_t module_flags_taint(struct module *mod, char *buf) 846 - { 847 - size_t l = 0; 848 - 849 - if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) 850 - buf[l++] = 'P'; 851 - if (mod->taints & (1 << TAINT_OOT_MODULE)) 852 - buf[l++] = 'O'; 853 - if (mod->taints & (1 << TAINT_FORCED_MODULE)) 854 - buf[l++] = 'F'; 855 - if (mod->taints & (1 << TAINT_CRAP)) 856 - buf[l++] = 'C'; 857 - /* 858 - * TAINT_FORCED_RMMOD: could be added. 859 - * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't 860 - * apply to modules. 861 - */ 862 - return l; 863 - } 864 - 865 845 static inline void print_unload_info(struct seq_file *m, struct module *mod) 866 846 { 867 847 struct module_use *use; ··· 941 961 return 0; 942 962 } 943 963 #endif /* CONFIG_MODULE_UNLOAD */ 964 + 965 + static size_t module_flags_taint(struct module *mod, char *buf) 966 + { 967 + size_t l = 0; 968 + 969 + if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) 970 + buf[l++] = 'P'; 971 + if (mod->taints & (1 << TAINT_OOT_MODULE)) 972 + buf[l++] = 'O'; 973 + if (mod->taints & (1 << TAINT_FORCED_MODULE)) 974 + buf[l++] = 'F'; 975 + if (mod->taints & (1 << TAINT_CRAP)) 976 + buf[l++] = 'C'; 977 + /* 978 + * TAINT_FORCED_RMMOD: could be added. 979 + * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't 980 + * apply to modules. 981 + */ 982 + return l; 983 + } 944 984 945 985 static ssize_t show_initstate(struct module_attribute *mattr, 946 986 struct module_kobject *mk, char *buffer)