All of lore.kernel.org
 help / color / mirror / Atom feed
* [l1k:doe 8/15] lib/spdm_requester.c:1005:50: error: too few arguments to function call, expected 6, have 2
@ 2023-09-03  0:54 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-09-03  0:54 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: oe-kbuild-all

tree:   https://github.com/l1k/linux doe
head:   134b3cb0cca6924ac200763fa64b27b2587f2cd9
commit: d8617e4f95e9e3c4979d5b423486f03da5ea5f41 [8/15] PCI/CMA: Validate Subject Alternative Name in certificates
config: arm64-randconfig-r006-20230903 (https://download.01.org/0day-ci/archive/20230903/202309030823.m5zCI2ta-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230903/202309030823.m5zCI2ta-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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309030823.m5zCI2ta-lkp@intel.com/

All errors (new ones prefixed by >>):

>> lib/spdm_requester.c:1005:50: error: too few arguments to function call, expected 6, have 2
                   rc = spdm_state->validate(spdm_state->dev, cert);
                        ~~~~~~~~~~~~~~~~~~~~                      ^
>> lib/spdm_requester.c:1458:23: error: incompatible function pointer types assigning to 'spdm_transport *' (aka 'int (*)(void *, struct device *, const void *, unsigned long, void *, unsigned long)') from 'spdm_validate *' (aka 'int (*)(struct device *, struct x509_certificate *)') [-Wincompatible-function-pointer-types]
           spdm_state->validate = validate;
                                ^ ~~~~~~~~
   2 errors generated.


vim +1005 lib/spdm_requester.c

   940	
   941	static int spdm_validate_certificate(struct spdm_state *spdm_state, u8 slot,
   942					     u8 *certs, size_t total_length)
   943	{
   944		struct x509_certificate *cert, *prev = NULL;
   945		size_t offset = 0;
   946		struct key *key;
   947		int rc, length;
   948	
   949		while (offset < total_length) {
   950			rc = x509_get_certificate_length(certs + offset,
   951							 total_length - offset);
   952			if (rc < 0) {
   953				dev_err(spdm_state->dev, "Malformed certificate "
   954					"at slot %hhu offset %zu\n", slot, offset);
   955				goto err_free_prev;
   956			}
   957	
   958			length = rc;
   959	
   960			cert = x509_cert_parse(certs + offset, length);
   961			if (IS_ERR(cert)) {
   962				rc = PTR_ERR(cert);
   963				dev_err(spdm_state->dev, "Certificate parse error %d "
   964					"at slot %hhu offset %zu\n", rc, slot, offset);
   965				goto err_free_prev;
   966			}
   967	
   968			if (!prev) {
   969				/* First cert in chain, check against root_keyring */
   970				key = find_asymmetric_key(spdm_state->root_keyring,
   971							  cert->sig->auth_ids[0],
   972							  cert->sig->auth_ids[1],
   973							  cert->sig->auth_ids[2],
   974							  false);
   975				if (IS_ERR(key)) {
   976					dev_info(spdm_state->dev, "Root certificate "
   977						 "for slot %hhu not found in %s "
   978						 "keyring: %s\n", slot,
   979						 spdm_state->root_keyring->description,
   980						 cert->issuer);
   981					rc = PTR_ERR(key);
   982					goto err_free_cert;
   983				}
   984	
   985				rc = verify_signature(key, cert->sig);
   986				key_put(key);
   987			} else {
   988				/* Subsequent cert in chain, check against previous */
   989				rc = public_key_verify_signature(prev->pub, cert->sig);
   990			}
   991	
   992			if (rc) {
   993				dev_err(spdm_state->dev, "Signature validation error "
   994					"%d at slot %hhu offset %zu\n",
   995					rc, slot, offset);
   996				goto err_free_cert;
   997			}
   998	
   999			x509_free_certificate(prev);
  1000			offset += length;
  1001			prev = cert;
  1002		}
  1003	
  1004		if (spdm_state->validate) {
> 1005			rc = spdm_state->validate(spdm_state->dev, cert);
  1006			if (rc)
  1007				goto err_free_cert;
  1008		}
  1009	
  1010		spdm_state->leaf_key = cert->pub;
  1011		cert->pub = NULL;
  1012		prev = NULL;
  1013	
  1014	err_free_cert:
  1015		x509_free_certificate(cert);
  1016	err_free_prev:
  1017		x509_free_certificate(prev);
  1018		return rc;
  1019	}
  1020	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-03  0:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-03  0:54 [l1k:doe 8/15] lib/spdm_requester.c:1005:50: error: too few arguments to function call, expected 6, have 2 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.