Re: [PATCH v2] firmware_loader: Add debug message with checksum for FW file

From: kernel test robot
Date: Tue Feb 28 2023 - 09:59:53 EST


Hi Amadeusz,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on driver-core/driver-core-testing]
[also build test ERROR on driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.2 next-20230228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Amadeusz-S-awi-ski/firmware_loader-Add-debug-message-with-checksum-for-FW-file/20230228-185558
patch link: https://lore.kernel.org/r/20230228185507.1729059-1-amadeuszx.slawinski%40linux.intel.com
patch subject: [PATCH v2] firmware_loader: Add debug message with checksum for FW file
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20230228/202302282231.g7ZUHJUm-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/229a0f94cfda465aff751f6a0395b8d6c6688acd
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Amadeusz-S-awi-ski/firmware_loader-Add-debug-message-with-checksum-for-FW-file/20230228-185558
git checkout 229a0f94cfda465aff751f6a0395b8d6c6688acd
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 olddefconfig
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202302282231.g7ZUHJUm-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

ld: drivers/base/firmware_loader/main.o: in function `fw_log_firmware_info':
>> drivers/base/firmware_loader/main.c:805: undefined reference to `crypto_alloc_shash'
>> ld: drivers/base/firmware_loader/main.c:817: undefined reference to `crypto_shash_digest'
ld: drivers/base/firmware_loader/main.o: in function `crypto_free_shash':
>> include/crypto/hash.h:736: undefined reference to `crypto_destroy_tfm'


vim +805 drivers/base/firmware_loader/main.c

797
798 static void fw_log_firmware_info(const struct firmware *fw, const char *name, struct device *device)
799 {
800 struct shash_desc *shash;
801 struct crypto_shash *alg;
802 u8 *sha256buf;
803 char *outbuf;
804
> 805 alg = crypto_alloc_shash("sha256", 0, 0);
806 if (!alg)
807 return;
808
809 sha256buf = kmalloc(SHA256_DIGEST_SIZE, GFP_KERNEL);
810 outbuf = kmalloc(SHA256_BLOCK_SIZE + 1, GFP_KERNEL);
811 shash = kmalloc(sizeof(*shash) + crypto_shash_descsize(alg), GFP_KERNEL);
812 if (!sha256buf || !outbuf || !shash)
813 goto out_free;
814
815 shash->tfm = alg;
816
> 817 if (crypto_shash_digest(shash, fw->data, fw->size, sha256buf) < 0)
818 goto out_shash;
819
820 for (int i = 0; i < SHA256_DIGEST_SIZE; i++)
821 sprintf(&outbuf[i * 2], "%02x", sha256buf[i]);
822 outbuf[SHA256_BLOCK_SIZE] = 0;
823 dev_dbg(device, "Loaded FW: %s, sha256: %s\n", name, outbuf);
824
825 out_shash:
826 crypto_free_shash(alg);
827 out_free:
828 kfree(shash);
829 kfree(outbuf);
830 kfree(sha256buf);
831 }
832 #else
833 static void fw_log_firmware_info(const struct firmware *fw, const char *name,
834 struct device *device)
835 {}
836 #endif
837

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests