crypto/ahash.c:1058:8-15: WARNING opportunity for kmemdup
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 2c9c612abeb38aab0e87d48496de6fd6daafb00b commit: 04bfa4c7d5119ca38f8133bfdae7957a60c8b221 [4057/5419] crypto: hash - Add HASH_REQUEST_ON_STACK config: nios2-randconfig-r054-20250422 (https://download.01.org/0day-ci/archive/20250423/[email protected]/config) compiler: nios2-linux-gcc (GCC) 13.3.0
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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
cocci warnings: (new ones prefixed by >>)
>> crypto/ahash.c:1058:8-15: WARNING opportunity for kmemdup
vim +1058 crypto/ahash.c
1051
1052 struct ahash_request *ahash_request_clone(struct ahash_request *req,
1053 size_t total, gfp_t gfp)
1054 {
1055 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
1056 struct ahash_request *nreq;
1057
> 1058 nreq = kmalloc(total, gfp);
1059 if (!nreq) {
1060 ahash_request_set_tfm(req, tfm->fb);
1061 req->base.flags = CRYPTO_TFM_REQ_ON_STACK;
1062 return req;
1063 }
1064
1065 memcpy(nreq, req, total);
1066 ahash_request_set_tfm(req, tfm);
1067 return req;
1068 }
1069 EXPORT_SYMBOL_GPL(ahash_request_clone);
1070
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki