From ce8f445ebe46f206116d459e39164f3b85996a7e Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 11 Feb 2018 14:25:55 +0100 Subject: [PATCH] Fix a few warnings and divide by zero (speed_pos) --- include/interface.h | 1 + src/interface.c | 2 -- src/opencl.c | 7 ++++++- src/status.c | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/interface.h b/include/interface.h index 29c582d47..4dff5196d 100644 --- a/include/interface.h +++ b/include/interface.h @@ -1975,6 +1975,7 @@ int ascii_digest (hashcat_ctx_t *hashcat_ctx, char *out_buf, const size_t out_le int hashconfig_init (hashcat_ctx_t *hashcat_ctx); void hashconfig_destroy (hashcat_ctx_t *hashcat_ctx); u32 hashconfig_forced_kernel_threads (hashcat_ctx_t *hashcat_ctx); +u32 hashconfig_limited_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param); u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param); u32 hashconfig_get_kernel_loops (hashcat_ctx_t *hashcat_ctx); int hashconfig_general_defaults (hashcat_ctx_t *hashcat_ctx); diff --git a/src/interface.c b/src/interface.c index d49ae2c72..02ece6f5b 100644 --- a/src/interface.c +++ b/src/interface.c @@ -26032,8 +26032,6 @@ u32 hashconfig_limited_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_devi u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_param_t *device_param) { - const user_options_t *user_options = hashcat_ctx->user_options; - // a kernel can force a fixed value const u32 forced_kernel_threads = hashconfig_forced_kernel_threads (hashcat_ctx); diff --git a/src/opencl.c b/src/opencl.c index f70b31694..1f1867b0d 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -1318,7 +1318,12 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, if (user_options->speed_only == true) { - if (speed_msec > 4000) return -2; // special RC + if (speed_msec > 4000) + { + device_param->speed_pos = 1; + + return -2; // special RC + } } } diff --git a/src/status.c b/src/status.c index 6a6423d4a..b7c6686fa 100644 --- a/src/status.c +++ b/src/status.c @@ -1391,7 +1391,7 @@ double status_get_hashes_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int d { const u32 speed_pos = device_param->speed_pos; - for (int i = 0; i < speed_pos; i++) + for (u32 i = 0; i < speed_pos; i++) { speed_cnt += device_param->speed_cnt[i]; speed_msec += device_param->speed_msec[i];