Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: user - fix potential warnings in cryptouser.h

Function definitions in headers are usually marked as 'static inline'.

Since 'inline' is missing for crypto_reportstat(), if it were not
referenced from a .c file that includes this header, it would produce
a warning.

Also, 'struct crypto_user_alg' is not declared in this header.

I included <linux/crytouser.h> instead of adding the forward declaration
as suggested [1].

Detected by compile-testing this header as a standalone unit:

./include/crypto/internal/cryptouser.h:6:44: warning: ‘struct crypto_user_alg’ declared inside parameter list will not be visible outside of this definition or declaration
struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact);
^~~~~~~~~~~~~~~
./include/crypto/internal/cryptouser.h:11:12: warning: ‘crypto_reportstat’ defined but not used [-Wunused-function]
static int crypto_reportstat(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, struct nlattr **attrs)
^~~~~~~~~~~~~~~~~

[1] https://lkml.org/lkml/2019/6/13/1121

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Masahiro Yamada and committed by
Herbert Xu
939f146b 68289c63

+4 -1
+4 -1
include/crypto/internal/cryptouser.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 + #include <linux/cryptouser.h> 2 3 #include <net/netlink.h> 3 4 4 5 struct crypto_alg *crypto_alg_match(struct crypto_user_alg *p, int exact); ··· 7 6 #ifdef CONFIG_CRYPTO_STATS 8 7 int crypto_reportstat(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, struct nlattr **attrs); 9 8 #else 10 - static int crypto_reportstat(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, struct nlattr **attrs) 9 + static inline int crypto_reportstat(struct sk_buff *in_skb, 10 + struct nlmsghdr *in_nlh, 11 + struct nlattr **attrs) 11 12 { 12 13 return -ENOTSUPP; 13 14 }