From ea440005076686ba946da433049d4e68c4672984 Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Sun, 11 Aug 2019 14:08:42 +0100 Subject: [PATCH] xt_pknock, xt_SYSRQ: don't set shash_desc::flags. shash_desc::flags was removed from the kernel in 5.1, so removed the explicit assignment of zero to it. In the case of xt_pknock.c, the change is backwards-compatible because the shash_desc was already zero-initialized when the enclosing crypto struct was initialized. In the case of xt_SYSRQ.c, we add an initializer for the shash_desc which will ensure that all members which are not explicitly initialized will be initialized to zero, including .flags in the case of older kernels. Signed-off-by: Jeremy Sowden --- extensions/pknock/xt_pknock.c | 1 - extensions/xt_SYSRQ.c | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/extensions/pknock/xt_pknock.c b/extensions/pknock/xt_pknock.c index c76901ac4c1a..8021ea07e1b9 100644 --- a/extensions/pknock/xt_pknock.c +++ b/extensions/pknock/xt_pknock.c @@ -1125,7 +1125,6 @@ static int __init xt_pknock_mt_init(void) crypto.size = crypto_shash_digestsize(crypto.tfm); crypto.desc.tfm = crypto.tfm; - crypto.desc.flags = 0; pde = proc_mkdir("xt_pknock", init_net.proc_net); if (pde == NULL) { diff --git a/extensions/xt_SYSRQ.c b/extensions/xt_SYSRQ.c index c386c7e2db5d..f04bd2cdc0f2 100644 --- a/extensions/xt_SYSRQ.c +++ b/extensions/xt_SYSRQ.c @@ -74,7 +74,7 @@ static unsigned int sysrq_tg(const void *pdata, uint16_t len) { const char *data = pdata; int i, n; - struct shash_desc desc; + struct shash_desc desc = { .tfm = sysrq_tfm }; int ret; long new_seqno = 0; @@ -113,8 +113,6 @@ static unsigned int sysrq_tg(const void *pdata, uint16_t len) return NF_DROP; } - desc.tfm = sysrq_tfm; - desc.flags = 0; ret = crypto_shash_init(&desc); if (ret != 0) goto hash_fail; -- 2.20.1