From b5de5a8b25ae3b3bf25cb726da4a293b6f0b39d0 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Thu, 1 May 2014 12:19:41 -0500 Subject: [PATCH] kmod/core: checkpatch and sparse fixes - checkpatch doesn't like the FSF address since it's subject to change - checkpatch doesn't like strings split by line - whitespace fix - sparse suggested to change some variables and functions to static --- README.md | 2 +- kmod/core/core.c | 26 ++++++++++++-------------- kmod/core/kpatch.h | 4 +--- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c0d236b..6ee76c1 100644 --- a/README.md +++ b/README.md @@ -211,7 +211,7 @@ OR'ed in. Eventually we hope to have a dedicated `TAINT_KPATCH` flag instead. -Note that the `TAINT_OOT_MODULE` flag (64) will also be set, since the patch +Note that the `TAINT_OOT_MODULE` flag (4096) will also be set, since the patch module is built outside the Linux kernel source tree. If your patch module is unsigned, the `TAINT_FORCED_MODULE` flag (2) will also diff --git a/kmod/core/core.c b/kmod/core/core.c index 15828c1..ddfc6ef 100644 --- a/kmod/core/core.c +++ b/kmod/core/core.c @@ -13,9 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, - * 02110-1301, USA. + * along with this program; if not, see . */ /* Contains the code for the core kpatch module. Each patch module registers @@ -47,9 +45,9 @@ #include "kpatch.h" #define KPATCH_HASH_BITS 8 -DEFINE_HASHTABLE(kpatch_func_hash, KPATCH_HASH_BITS); +static DEFINE_HASHTABLE(kpatch_func_hash, KPATCH_HASH_BITS); -DEFINE_SEMAPHORE(kpatch_mutex); +static DEFINE_SEMAPHORE(kpatch_mutex); static int kpatch_num_registered; @@ -143,8 +141,8 @@ static struct kpatch_func *kpatch_get_prev_func(struct kpatch_func *f, return NULL; } -void kpatch_backtrace_address_verify(void *data, unsigned long address, - int reliable) +static void kpatch_backtrace_address_verify(void *data, unsigned long address, + int reliable) { struct kpatch_backtrace_args *args = data; struct kpatch_module *kpmod = args->kpmod; @@ -170,8 +168,8 @@ void kpatch_backtrace_address_verify(void *data, unsigned long address, } if (address >= func_addr && address < func_addr + func_size) { - pr_err("activeness safety check failed for function " - "at address 0x%lx\n", func_addr); + pr_err("activeness safety check failed for function at address 0x%lx\n", + func_addr); args->ret = -EBUSY; return; } @@ -183,10 +181,10 @@ static int kpatch_backtrace_stack(void *data, char *name) return 0; } -struct stacktrace_ops kpatch_backtrace_ops = { +static const struct stacktrace_ops kpatch_backtrace_ops = { .address = kpatch_backtrace_address_verify, .stack = kpatch_backtrace_stack, - .walk_stack = print_context_stack_bp, + .walk_stack = print_context_stack_bp, }; /* @@ -292,9 +290,9 @@ static int kpatch_remove_patch(void *data) * function, the last one to register wins, as it'll be first in the hash * bucket. */ -void notrace kpatch_ftrace_handler(unsigned long ip, unsigned long parent_ip, - struct ftrace_ops *fops, - struct pt_regs *regs) +static void notrace +kpatch_ftrace_handler(unsigned long ip, unsigned long parent_ip, + struct ftrace_ops *fops, struct pt_regs *regs) { struct kpatch_func *func; int state; diff --git a/kmod/core/kpatch.h b/kmod/core/kpatch.h index c5dc8b6..a317ecd 100644 --- a/kmod/core/kpatch.h +++ b/kmod/core/kpatch.h @@ -15,9 +15,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, - * 02110-1301, USA. + * along with this program; if not, see . * * Contains the API for the core kpatch module used by the patch modules */