From ba0f87d19522e4f3a8eaaa2e9926db4c924025eb Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Mon, 9 Dec 2024 01:34:31 +0300 Subject: [PATCH] Fix possible errors while building kernel module --- utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils.c b/utils.c index eb3f168..bfaf0ba 100644 --- a/utils.c +++ b/utils.c @@ -514,7 +514,9 @@ void z_function(const char *str, int *zbuf, size_t len) { for (int i = 1; i < (int)len; i++) { zbuf[i] = 0; if (i < rh) { - zbuf[i] = min(zbuf[i - lh], rh - i); + zbuf[i] = zbuf[i - lh]; + if (rh - i < zbuf[i]) + zbuf[i] = rh - i; } while (i + zbuf[i] < len && str[zbuf[i]] == str[i + zbuf[i]])