diff options
author | Kees Cook <keescook@chromium.org> | 2016-06-26 22:40:13 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-07-07 11:09:24 -0700 |
commit | 76a10e2b3a9dc3e6a290681aa126776c0ad304ad (patch) | |
tree | 61ac1892d3767092e7b6f5a13e81baa1ce8dba3b /drivers/misc/lkdtm_core.c | |
parent | 329d416ca0ecc38c2be2515897d0e0e8780af1ce (diff) | |
download | linux-76a10e2b3a9dc3e6a290681aa126776c0ad304ad.tar.gz linux-76a10e2b3a9dc3e6a290681aa126776c0ad304ad.tar.bz2 linux-76a10e2b3a9dc3e6a290681aa126776c0ad304ad.zip |
lkdtm: rename "count" to "crash_count"
The "count" variable name was not easy to understand, since it was regularly
obscured by local variables of the same name, and it's purpose wasn't clear.
This renames it (and its lock) to "crash_count", which is more readable.
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/misc/lkdtm_core.c')
-rw-r--r-- | drivers/misc/lkdtm_core.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c index 4f9d2f32c88b..fa7335ee08de 100644 --- a/drivers/misc/lkdtm_core.c +++ b/drivers/misc/lkdtm_core.c @@ -51,11 +51,6 @@ #include "lkdtm.h" -#define DEFAULT_COUNT 10 - -static int count = DEFAULT_COUNT; -static DEFINE_SPINLOCK(count_lock); - enum cname { CN_INVALID, CN_INT_HARDWARE_ENTRY, @@ -169,10 +164,13 @@ static struct jprobe lkdtm; static int lkdtm_parse_commandline(void); static void lkdtm_handler(void); +#define DEFAULT_COUNT 10 static char* cpoint_name; static char* cpoint_type; static int cpoint_count = DEFAULT_COUNT; static int recur_count = -1; +static int crash_count = DEFAULT_COUNT; +static DEFINE_SPINLOCK(crash_count_lock); static enum cname cpoint = CN_INVALID; static enum ctype cptype = CT_NONE; @@ -290,9 +288,9 @@ static int lkdtm_parse_commandline(void) if (cpoint_count < 1 || recur_count < 1) return -EINVAL; - spin_lock_irqsave(&count_lock, flags); - count = cpoint_count; - spin_unlock_irqrestore(&count_lock, flags); + spin_lock_irqsave(&crash_count_lock, flags); + crash_count = cpoint_count; + spin_unlock_irqrestore(&crash_count_lock, flags); /* No special parameters */ if (!cpoint_type && !cpoint_name) @@ -447,16 +445,16 @@ static void lkdtm_handler(void) unsigned long flags; bool do_it = false; - spin_lock_irqsave(&count_lock, flags); - count--; + spin_lock_irqsave(&crash_count_lock, flags); + crash_count--; pr_info("Crash point %s of type %s hit, trigger in %d rounds\n", - cp_name_to_str(cpoint), cp_type_to_str(cptype), count); + cp_name_to_str(cpoint), cp_type_to_str(cptype), crash_count); - if (count == 0) { + if (crash_count == 0) { do_it = true; - count = cpoint_count; + crash_count = cpoint_count; } - spin_unlock_irqrestore(&count_lock, flags); + spin_unlock_irqrestore(&crash_count_lock, flags); if (do_it) lkdtm_do_action(cptype); |