lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201810190734.gAC1zWwm%fengguang.wu@intel.com>
Date:   Fri, 19 Oct 2018 07:36:32 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Yael Chemla <yael.chemla@...s.arm.com>
Cc:     kbuild-all@...org, Gilad Ben-Yossef <gilad@...yossef.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S . Miller" <davem@...emloft.net>,
        linux-crypto@...r.kernel.org, Ofir Drang <ofir.drang@....com>,
        linux-kernel@...r.kernel.org,
        Yael Chemla <yael.chemla@...s.arm.com>
Subject: Re: [PATCH 3/3] crypto: ccree: add SM3 support

Hi Yael,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on crypto/master]
[also build test WARNING on v4.19-rc8 next-20181018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Yael-Chemla/crypto-ccree-add-SM3-support/20181019-042354
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git master
config: i386-randconfig-x019-201841 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/crypto/ccree/cc_hash.c:1729:17: error: 'CC_HW_REV_713' undeclared here (not in a function); did you mean 'CC_HW_REV_712'?
      .min_hw_rev = CC_HW_REV_713,
                    ^~~~~~~~~~~~~
                    CC_HW_REV_712
   drivers/crypto/ccree/cc_hash.c: In function 'cc_init_hash_sram':
   drivers/crypto/ccree/cc_hash.c:1832:40: warning: comparison between pointer and integer
     bool sm3_supported = (drvdata->hw_rev >= CC_HW_REV_713);
                                           ^~
   In file included from include/linux/kernel.h:10:0,
                    from drivers/crypto/ccree/cc_hash.c:4:
   drivers/crypto/ccree/cc_hash.c: In function 'cc_hash_alloc':
   drivers/crypto/ccree/cc_hash.c:1975:22: warning: comparison between pointer and integer
     if (drvdata->hw_rev >= CC_HW_REV_713)
                         ^
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/crypto/ccree/cc_hash.c:1975:2: note: in expansion of macro 'if'
     if (drvdata->hw_rev >= CC_HW_REV_713)
     ^~
   drivers/crypto/ccree/cc_hash.c:1975:22: warning: comparison between pointer and integer
     if (drvdata->hw_rev >= CC_HW_REV_713)
                         ^
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/crypto/ccree/cc_hash.c:1975:2: note: in expansion of macro 'if'
     if (drvdata->hw_rev >= CC_HW_REV_713)
     ^~
   drivers/crypto/ccree/cc_hash.c:1975:22: warning: comparison between pointer and integer
     if (drvdata->hw_rev >= CC_HW_REV_713)
                         ^
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/crypto/ccree/cc_hash.c:1975:2: note: in expansion of macro 'if'
     if (drvdata->hw_rev >= CC_HW_REV_713)
     ^~
   drivers/crypto/ccree/cc_hash.c: In function 'cc_larval_digest_addr':
   drivers/crypto/ccree/cc_hash.c:2252:41: warning: comparison between pointer and integer
     bool sm3_supported = (_drvdata->hw_rev >= CC_HW_REV_713);
                                            ^~

vim +/if +1975 drivers/crypto/ccree/cc_hash.c

  1952	
  1953	int cc_hash_alloc(struct cc_drvdata *drvdata)
  1954	{
  1955		struct cc_hash_handle *hash_handle;
  1956		cc_sram_addr_t sram_buff;
  1957		u32 sram_size_to_alloc;
  1958		struct device *dev = drvdata_to_dev(drvdata);
  1959		int rc = 0;
  1960		int alg;
  1961	
  1962		hash_handle = kzalloc(sizeof(*hash_handle), GFP_KERNEL);
  1963		if (!hash_handle)
  1964			return -ENOMEM;
  1965	
  1966		INIT_LIST_HEAD(&hash_handle->hash_list);
  1967		drvdata->hash_handle = hash_handle;
  1968	
  1969		sram_size_to_alloc = sizeof(digest_len_init) +
  1970				sizeof(md5_init) +
  1971				sizeof(sha1_init) +
  1972				sizeof(sha224_init) +
  1973				sizeof(sha256_init);
  1974	
> 1975		if (drvdata->hw_rev >= CC_HW_REV_713)
  1976			sram_size_to_alloc += sizeof(sm3_init);
  1977	
  1978		if (drvdata->hw_rev >= CC_HW_REV_712)
  1979			sram_size_to_alloc += sizeof(digest_len_sha512_init) +
  1980				sizeof(sha384_init) + sizeof(sha512_init);
  1981	
  1982		sram_buff = cc_sram_alloc(drvdata, sram_size_to_alloc);
  1983		if (sram_buff == NULL_SRAM_ADDR) {
  1984			dev_err(dev, "SRAM pool exhausted\n");
  1985			rc = -ENOMEM;
  1986			goto fail;
  1987		}
  1988	
  1989		/* The initial digest-len offset */
  1990		hash_handle->digest_len_sram_addr = sram_buff;
  1991	
  1992		/*must be set before the alg registration as it is being used there*/
  1993		rc = cc_init_hash_sram(drvdata);
  1994		if (rc) {
  1995			dev_err(dev, "Init digest CONST failed (rc=%d)\n", rc);
  1996			goto fail;
  1997		}
  1998	
  1999		/* ahash registration */
  2000		for (alg = 0; alg < ARRAY_SIZE(driver_hash); alg++) {
  2001			struct cc_hash_alg *t_alg;
  2002			int hw_mode = driver_hash[alg].hw_mode;
  2003	
  2004			/* We either support both HASH and MAC or none */
  2005			if (driver_hash[alg].min_hw_rev > drvdata->hw_rev)
  2006				continue;
  2007			if (driver_hash[alg].is_mac) {
  2008				/* register hmac version */
  2009				t_alg = cc_alloc_hash_alg(&driver_hash[alg], dev, true);
  2010				if (IS_ERR(t_alg)) {
  2011					rc = PTR_ERR(t_alg);
  2012					dev_err(dev, "%s alg allocation failed\n",
  2013						driver_hash[alg].driver_name);
  2014					goto fail;
  2015				}
  2016				t_alg->drvdata = drvdata;
  2017	
  2018				rc = crypto_register_ahash(&t_alg->ahash_alg);
  2019				if (rc) {
  2020					dev_err(dev, "%s alg registration failed\n",
  2021						driver_hash[alg].driver_name);
  2022					kfree(t_alg);
  2023					goto fail;
  2024				} else {
  2025					list_add_tail(&t_alg->entry,
  2026						      &hash_handle->hash_list);
  2027				}
  2028			}
  2029			if (hw_mode == DRV_CIPHER_XCBC_MAC ||
  2030			    hw_mode == DRV_CIPHER_CMAC)
  2031				continue;
  2032	
  2033			/* register hash version */
  2034			t_alg = cc_alloc_hash_alg(&driver_hash[alg], dev, false);
  2035			if (IS_ERR(t_alg)) {
  2036				rc = PTR_ERR(t_alg);
  2037				dev_err(dev, "%s alg allocation failed\n",
  2038					driver_hash[alg].driver_name);
  2039				goto fail;
  2040			}
  2041			t_alg->drvdata = drvdata;
  2042	
  2043			rc = crypto_register_ahash(&t_alg->ahash_alg);
  2044			if (rc) {
  2045				dev_err(dev, "%s alg registration failed\n",
  2046					driver_hash[alg].driver_name);
  2047				kfree(t_alg);
  2048				goto fail;
  2049			} else {
  2050				list_add_tail(&t_alg->entry, &hash_handle->hash_list);
  2051			}
  2052		}
  2053	
  2054		return 0;
  2055	
  2056	fail:
  2057		kfree(drvdata->hash_handle);
  2058		drvdata->hash_handle = NULL;
  2059		return rc;
  2060	}
  2061	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (27996 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ