Re: [PATCH bpf-next v2 1/2] bpf: add skcipher API support to TC/XDP programs
From: kernel test robot <hidden>
Date: 2023-10-28 00:25:05
Also in:
bpf, linux-crypto, oe-kbuild-all
Hi Vadim, kernel test robot noticed the following build warnings: [auto build test WARNING on bpf-next/master] url: https://github.com/intel-lab-lkp/linux/commits/Vadim-Fedorenko/selftests-bpf-crypto-skcipher-algo-selftests/20231028-020332 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master patch link: https://lore.kernel.org/r/20231027172039.1365917-1-vadfed%40meta.com patch subject: [PATCH bpf-next v2 1/2] bpf: add skcipher API support to TC/XDP programs config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20231028/202310280854.tycUngCC-lkp@intel.com/config) compiler: mips-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231028/202310280854.tycUngCC-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot [off-list ref] | Closes: https://lore.kernel.org/oe-kbuild-all/202310280854.tycUngCC-lkp@intel.com/ (local) All warnings (new ones prefixed by >>):
quoted
kernel/bpf/crypto.c:74: warning: Function parameter or member 'palgo' not described in 'bpf_crypto_skcipher_ctx_create' kernel/bpf/crypto.c:74: warning: Function parameter or member 'pkey' not described in 'bpf_crypto_skcipher_ctx_create' kernel/bpf/crypto.c:74: warning: Function parameter or member 'err' not described in 'bpf_crypto_skcipher_ctx_create' kernel/bpf/crypto.c:74: warning: Excess function parameter 'algo' description in 'bpf_crypto_skcipher_ctx_create' kernel/bpf/crypto.c:74: warning: Excess function parameter 'key' description in 'bpf_crypto_skcipher_ctx_create'
vim +74 kernel/bpf/crypto.c
58
59 /**
60 * bpf_crypto_skcipher_ctx_create() - Create a mutable BPF crypto context.
61 *
62 * Allocates a crypto context that can be used, acquired, and released by
63 * a BPF program. The crypto context returned by this function must either
64 * be embedded in a map as a kptr, or freed with bpf_crypto_skcipher_ctx_release().
65 *
66 * bpf_crypto_skcipher_ctx_create() allocates memory using the BPF memory
67 * allocator, and will not block. It may return NULL if no memory is available.
68 * @algo: bpf_dynptr which holds string representation of algorithm.
69 * @key: bpf_dynptr which holds cipher key to do crypto.
70 */
71 __bpf_kfunc struct bpf_crypto_skcipher_ctx *
72 bpf_crypto_skcipher_ctx_create(const struct bpf_dynptr_kern *palgo,
73 const struct bpf_dynptr_kern *pkey, int *err)
> 74 {
75 struct bpf_crypto_skcipher_ctx *ctx;
76 char *algo;
77
78 if (__bpf_dynptr_size(palgo) > CRYPTO_MAX_ALG_NAME) {
79 *err = -EINVAL;
80 return NULL;
81 }
82
83 algo = __bpf_dynptr_data_ptr(palgo);
84
85 if (!crypto_has_skcipher(algo, CRYPTO_ALG_TYPE_SKCIPHER, CRYPTO_ALG_TYPE_MASK)) {
86 *err = -EOPNOTSUPP;
87 return NULL;
88 }
89
90 ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
91 if (!ctx) {
92 *err = -ENOMEM;
93 return NULL;
94 }
95
96 memset(ctx, 0, sizeof(*ctx));
97
98 ctx->tfm = crypto_alloc_sync_skcipher(algo, 0, 0);
99 if (IS_ERR(ctx->tfm)) {
100 *err = PTR_ERR(ctx->tfm);
101 ctx->tfm = NULL;
102 goto err;
103 }
104
105 *err = crypto_sync_skcipher_setkey(ctx->tfm, __bpf_dynptr_data_ptr(pkey),
106 __bpf_dynptr_size(pkey));
107 if (*err)
108 goto err;
109
110 refcount_set(&ctx->usage, 1);
111
112 return ctx;
113 err:
114 if (ctx->tfm)
115 crypto_free_sync_skcipher(ctx->tfm);
116 kfree(ctx);
117
118 return NULL;
119 }
120
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki