From 4a282b32c2d34552a9fb235ca8bf30f3b2af392d Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 28 Apr 2020 13:29:19 +0200 Subject: [PATCH] cppchecker fix --- tools/hitag2crack/crack5gpu/ht2crack5.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/hitag2crack/crack5gpu/ht2crack5.c b/tools/hitag2crack/crack5gpu/ht2crack5.c index 8e6c29c76..adaf1ae82 100644 --- a/tools/hitag2crack/crack5gpu/ht2crack5.c +++ b/tools/hitag2crack/crack5gpu/ht2crack5.c @@ -129,6 +129,11 @@ void runKernel(struct context *ctx, uint32_t cand_base, uint64_t *matches, uint3 // Write our data set into the input array in device memory err = clEnqueueWriteBuffer(ctx->commands, ctx->matches_found, CL_TRUE, 0, sizeof(uint32_t), matches_found, 0, NULL, NULL); + if (err != CL_SUCCESS) { + printf("Error: Failed to enque kernel writebuffer in runKernel! %d\n", err); + exit(1); + } + // Set the arguments to our compute kernel err = clSetKernelArg(ctx->kernel, 0, sizeof(uint32_t), &cand_base); err |= clSetKernelArg(ctx->kernel, 4, sizeof(cl_mem), &ctx->matches_found); @@ -231,7 +236,7 @@ int main(int argc, char *argv[]) { for (size_t i0 = 0; i0 < 1 << 20; i0++) { uint64_t state0 = expand(0x5806b4a2d16c, i0); - if (f(state0) == (target >> 31)) { + if (f(state0) == target >> 31 ) { // cf kernel, state is now split in 3 shorts >> 2 candidates[(layer_0_found * 3) + 0] = (uint16_t)((state0 >> (32 + 2)) & 0xffff); candidates[(layer_0_found * 3) + 1] = (uint16_t)((state0 >> (16 + 2)) & 0xffff);