diff --git a/kernel/module/gki_module.c b/kernel/module/gki_module.c index fc2968c3791e..4f124f9a14ec 100644 --- a/kernel/module/gki_module.c +++ b/kernel/module/gki_module.c @@ -34,8 +34,17 @@ static int cmp_name(const void *sym, const void *protected_sym) */ bool gki_is_module_protected_export(const char *name) { - return bsearch(name, gki_protected_exports_symbols, NR_PROTECTED_EXPORTS_SYMBOLS, + if (NR_UNPROTECTED_SYMBOLS) { + return bsearch(name, gki_protected_exports_symbols, NR_PROTECTED_EXPORTS_SYMBOLS, MAX_PROTECTED_EXPORTS_NAME_LEN, cmp_name) != NULL; + } else { + /* + * If there are no symbols in unprotected list; We don't need to + * protect exports as there is no KMI enforcement. + * Treat everything exportable in this case. + */ + return false; + } } /** @@ -52,7 +61,7 @@ bool gki_is_module_unprotected_symbol(const char *name) /* * If there are no symbols in unprotected list; * there isn't a KMI enforcement for the kernel. - * Treat evertything accessible in this case. + * Treat everything accessible in this case. */ return true; }