]> git.ipfire.org Git - thirdparty/xtables-addons.git/commit
xt_pknock: fix do_div() signness mismatch master
authorQingfang Deng <dqfext@gmail.com>
Mon, 29 Dec 2025 06:26:07 +0000 (07:26 +0100)
committerJan Engelhardt <jengelh@inai.de>
Mon, 29 Dec 2025 09:48:08 +0000 (10:48 +0100)
commit3c5c336fc0e47fea9baa912fc8d314ae9d1fa521
tree99c8d8c8b90ef920675ae30196dd3bf6b1282f6a
parent438a7e519ac4f71d8423e323bc2d1aabfb059692
xt_pknock: fix do_div() signness mismatch

do_div() expects an unsigned 64-bit dividend, but time64_t is signed. On
32-bit arch, this triggers a warnning:

In file included from ./arch/arm/include/asm/div64.h:107,
                 from ./include/linux/math.h:6,
                 from ./include/linux/math64.h:6,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:13,
                 from ./xtables-addons-3.30/extensions/pknock/xt_pknock.c:10:
./xtables-addons-3.30/extensions/pknock/xt_pknock.c: In function 'has_secret':
./include/asm-generic/div64.h:222:35: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
  222 |         (void)(((typeof((n)) *)0) == ((uint64_t *)0));  \
      |                                   ^~
./xtables-addons-3.30/extensions/pknock/xt_pknock.c:747:17: note: in expansion of macro 'do_div'
  747 |                 do_div(t, 60);
      |

Change the type of variable `t` to uint64_t to fix this.

Fixes: 397b282dba9a ("xt_pknock: use walltime for building hash")
Signed-off-by: Qingfang Deng <dqfext@gmail.com>
extensions/pknock/xt_pknock.c