All of lore.kernel.org
 help / color / mirror / Atom feed
* [lee-linaro:tb-fix-w1-warnings 215/226] drivers/scsi/bfa/bfa_fcs_lport.c:1912 bfa_fcs_lport_fdmi_build_rhba_pyld() warn: signedness bug returning '(-12)'
@ 2021-02-27  0:30 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-02-27  0:30 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 23987 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Lee Jones <lee.jones@linaro.org>

Hi Lee,

First bad commit (maybe != root cause):

tree:   https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head:   49fe493a5f7cebaec70944df919df3350d4cb520
commit: ffdcc79844033bab9aae2f65246b91334831ee11 [215/226] fixup! scsi: bfa: bfa_fcs_lport: Move a large struct from the stack onto the heap
:::::: branch date: 8 hours ago
:::::: commit date: 10 hours ago
config: xtensa-randconfig-m031-20210227 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/scsi/bfa/bfa_fcs_lport.c:1912 bfa_fcs_lport_fdmi_build_rhba_pyld() warn: signedness bug returning '(-12)'

vim +1912 drivers/scsi/bfa/bfa_fcs_lport.c

a36c61f9025b8924 Krishna Gudipati   2010-09-15  1898  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1899  static          u16
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1900  bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1901  {
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1902  	struct bfa_fcs_lport_s *port = fdmi->ms->port;
ffdcc79844033bab Lee Jones          2021-02-26  1903  	struct bfa_fcs_fdmi_hba_attr_s *fcs_hba_attr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1904  	struct fdmi_rhba_s *rhba = (struct fdmi_rhba_s *) pyld;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1905  	struct fdmi_attr_s *attr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1906  	u8        *curr_ptr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1907  	u16        len, count;
50444a340028119c Maggie             2010-11-29  1908  	u16	templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1909  
ffdcc79844033bab Lee Jones          2021-02-26  1910  	fcs_hba_attr = kzalloc(sizeof(*fcs_hba_attr), GFP_KERNEL);
ffdcc79844033bab Lee Jones          2021-02-26  1911  	if (!fcs_hba_attr)
7ba45b2cf0939bf6 Lee Jones          2021-02-25 @1912  		return -ENOMEM;
7ba45b2cf0939bf6 Lee Jones          2021-02-25  1913  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1914  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1915  	 * get hba attributes
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1916  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1917  	bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1918  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1919  	rhba->hba_id = bfa_fcs_lport_get_pwwn(port);
ba816ea8e2eacbf3 Jing Huang         2010-10-18  1920  	rhba->port_list.num_ports = cpu_to_be32(1);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1921  	rhba->port_list.port_entry = bfa_fcs_lport_get_pwwn(port);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1922  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1923  	len = sizeof(rhba->hba_id) + sizeof(rhba->port_list);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1924  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1925  	count = 0;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1926  	len += sizeof(rhba->hba_attr_blk.attr_count);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1927  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1928  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1929  	 * fill out the invididual entries of the HBA attrib Block
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1930  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1931  	curr_ptr = (u8 *) &rhba->hba_attr_blk.hba_attr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1932  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1933  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1934  	 * Node Name
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1935  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1936  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  1937  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODENAME);
50444a340028119c Maggie             2010-11-29  1938  	templen = sizeof(wwn_t);
50444a340028119c Maggie             2010-11-29  1939  	memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), templen);
50444a340028119c Maggie             2010-11-29  1940  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  1941  	len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1942  	count++;
50444a340028119c Maggie             2010-11-29  1943  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  1944  			     sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1945  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1946  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1947  	 * Manufacturer
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1948  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1949  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  1950  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MANUFACTURER);
50444a340028119c Maggie             2010-11-29  1951  	templen = (u16) strlen(fcs_hba_attr->manufacturer);
50444a340028119c Maggie             2010-11-29  1952  	memcpy(attr->value, fcs_hba_attr->manufacturer, templen);
50444a340028119c Maggie             2010-11-29  1953  	templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  1954  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  1955  	len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1956  	count++;
50444a340028119c Maggie             2010-11-29  1957  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  1958  			     sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1959  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1960  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1961  	 * Serial Number
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1962  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1963  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  1964  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_SERIALNUM);
50444a340028119c Maggie             2010-11-29  1965  	templen = (u16) strlen(fcs_hba_attr->serial_num);
50444a340028119c Maggie             2010-11-29  1966  	memcpy(attr->value, fcs_hba_attr->serial_num, templen);
50444a340028119c Maggie             2010-11-29  1967  	templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  1968  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  1969  	len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1970  	count++;
50444a340028119c Maggie             2010-11-29  1971  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  1972  			     sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1973  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1974  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1975  	 * Model
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1976  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1977  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  1978  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL);
50444a340028119c Maggie             2010-11-29  1979  	templen = (u16) strlen(fcs_hba_attr->model);
50444a340028119c Maggie             2010-11-29  1980  	memcpy(attr->value, fcs_hba_attr->model, templen);
50444a340028119c Maggie             2010-11-29  1981  	templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  1982  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  1983  	len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1984  	count++;
50444a340028119c Maggie             2010-11-29  1985  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  1986  			     sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1987  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1988  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1989  	 * Model Desc
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1990  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1991  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  1992  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL_DESC);
50444a340028119c Maggie             2010-11-29  1993  	templen = (u16) strlen(fcs_hba_attr->model_desc);
50444a340028119c Maggie             2010-11-29  1994  	memcpy(attr->value, fcs_hba_attr->model_desc, templen);
50444a340028119c Maggie             2010-11-29  1995  	templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  1996  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  1997  	len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1998  	count++;
50444a340028119c Maggie             2010-11-29  1999  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  2000  			     sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2001  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2002  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2003  	 * H/W Version
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2004  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2005  	if (fcs_hba_attr->hw_version[0] != '\0') {
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2006  		attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  2007  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_HW_VERSION);
50444a340028119c Maggie             2010-11-29  2008  		templen = (u16) strlen(fcs_hba_attr->hw_version);
50444a340028119c Maggie             2010-11-29  2009  		memcpy(attr->value, fcs_hba_attr->hw_version, templen);
50444a340028119c Maggie             2010-11-29  2010  		templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  2011  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  2012  		len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2013  		count++;
50444a340028119c Maggie             2010-11-29  2014  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  2015  					 sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2016  	}
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2017  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2018  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2019  	 * Driver Version
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2020  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2021  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  2022  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_DRIVER_VERSION);
50444a340028119c Maggie             2010-11-29  2023  	templen = (u16) strlen(fcs_hba_attr->driver_version);
50444a340028119c Maggie             2010-11-29  2024  	memcpy(attr->value, fcs_hba_attr->driver_version, templen);
50444a340028119c Maggie             2010-11-29  2025  	templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  2026  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
dd5aaf4536c51117 Krishna Gudipati   2011-06-13  2027  	len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2028  	count++;
50444a340028119c Maggie             2010-11-29  2029  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  2030  			     sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2031  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2032  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2033  	 * Option Rom Version
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2034  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2035  	if (fcs_hba_attr->option_rom_ver[0] != '\0') {
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2036  		attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  2037  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_ROM_VERSION);
50444a340028119c Maggie             2010-11-29  2038  		templen = (u16) strlen(fcs_hba_attr->option_rom_ver);
50444a340028119c Maggie             2010-11-29  2039  		memcpy(attr->value, fcs_hba_attr->option_rom_ver, templen);
50444a340028119c Maggie             2010-11-29  2040  		templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  2041  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  2042  		len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2043  		count++;
50444a340028119c Maggie             2010-11-29  2044  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  2045  					 sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2046  	}
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2047  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2048  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  2049  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FW_VERSION);
b480a32e69b7b3c8 Krishna Gudipati   2012-09-21  2050  	templen = (u16) strlen(fcs_hba_attr->fw_version);
b480a32e69b7b3c8 Krishna Gudipati   2012-09-21  2051  	memcpy(attr->value, fcs_hba_attr->fw_version, templen);
50444a340028119c Maggie             2010-11-29  2052  	templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  2053  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  2054  	len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2055  	count++;
50444a340028119c Maggie             2010-11-29  2056  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  2057  			     sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2058  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2059  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2060  	 * OS Name
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2061  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2062  	if (fcs_hba_attr->os_name[0] != '\0') {
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2063  		attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  2064  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_OS_NAME);
50444a340028119c Maggie             2010-11-29  2065  		templen = (u16) strlen(fcs_hba_attr->os_name);
50444a340028119c Maggie             2010-11-29  2066  		memcpy(attr->value, fcs_hba_attr->os_name, templen);
50444a340028119c Maggie             2010-11-29  2067  		templen = fc_roundup(templen, sizeof(u32));
50444a340028119c Maggie             2010-11-29  2068  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  2069  		len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2070  		count++;
50444a340028119c Maggie             2010-11-29  2071  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  2072  					sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2073  	}
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2074  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2075  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2076  	 * MAX_CT_PAYLOAD
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2077  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2078  	attr = (struct fdmi_attr_s *) curr_ptr;
ba816ea8e2eacbf3 Jing Huang         2010-10-18  2079  	attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT);
50444a340028119c Maggie             2010-11-29  2080  	templen = sizeof(fcs_hba_attr->max_ct_pyld);
50444a340028119c Maggie             2010-11-29  2081  	memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, templen);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2082  	templen = fc_roundup(templen, sizeof(u32));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2083  	curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2084  	len += templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2085  	count++;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2086  	attr->len = cpu_to_be16(templen + sizeof(attr->type) +
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2087  			     sizeof(templen));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2088  	/*
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2089  	 * Send extended attributes ( FOS 7.1 support )
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2090  	 */
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2091  	if (fdmi->retry_cnt == 0) {
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2092  		attr = (struct fdmi_attr_s *) curr_ptr;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2093  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODE_SYM_NAME);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2094  		templen = sizeof(fcs_hba_attr->node_sym_name);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2095  		memcpy(attr->value, &fcs_hba_attr->node_sym_name, templen);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2096  		templen = fc_roundup(templen, sizeof(u32));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2097  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2098  		len += templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2099  		count++;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2100  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2101  					sizeof(templen));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2102  
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2103  		attr = (struct fdmi_attr_s *) curr_ptr;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2104  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_VENDOR_ID);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2105  		templen = sizeof(fcs_hba_attr->vendor_info);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2106  		memcpy(attr->value, &fcs_hba_attr->vendor_info, templen);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2107  		templen = fc_roundup(templen, sizeof(u32));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2108  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2109  		len += templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2110  		count++;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2111  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2112  					sizeof(templen));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2113  
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2114  		attr = (struct fdmi_attr_s *) curr_ptr;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2115  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NUM_PORTS);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2116  		templen = sizeof(fcs_hba_attr->num_ports);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2117  		memcpy(attr->value, &fcs_hba_attr->num_ports, templen);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2118  		templen = fc_roundup(templen, sizeof(u32));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2119  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2120  		len += templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2121  		count++;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2122  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2123  					sizeof(templen));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2124  
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2125  		attr = (struct fdmi_attr_s *) curr_ptr;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2126  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FABRIC_NAME);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2127  		templen = sizeof(fcs_hba_attr->fabric_name);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2128  		memcpy(attr->value, &fcs_hba_attr->fabric_name, templen);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2129  		templen = fc_roundup(templen, sizeof(u32));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2130  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
50444a340028119c Maggie             2010-11-29  2131  		len += templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2132  		count++;
50444a340028119c Maggie             2010-11-29  2133  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
50444a340028119c Maggie             2010-11-29  2134  					sizeof(templen));
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2135  
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2136  		attr = (struct fdmi_attr_s *) curr_ptr;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2137  		attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_BIOS_VER);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2138  		templen = sizeof(fcs_hba_attr->bios_ver);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2139  		memcpy(attr->value, &fcs_hba_attr->bios_ver, templen);
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2140  		templen = fc_roundup(attr->len, sizeof(u32));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2141  		curr_ptr += sizeof(attr->type) + sizeof(templen) + templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2142  		len += templen;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2143  		count++;
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2144  		attr->len = cpu_to_be16(templen + sizeof(attr->type) +
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2145  					sizeof(templen));
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2146  	}
d7cbc3044f2b2883 Vijaya Mohan Guvva 2013-05-13  2147  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2148  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2149  	 * Update size of payload
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2150  	 */
5fbe25c7a6646016 Jing Huang         2010-10-18  2151  	len += ((sizeof(attr->type) + sizeof(attr->len)) * count);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2152  
ba816ea8e2eacbf3 Jing Huang         2010-10-18  2153  	rhba->hba_attr_blk.attr_count = cpu_to_be32(count);
7ba45b2cf0939bf6 Lee Jones          2021-02-25  2154  
ffdcc79844033bab Lee Jones          2021-02-26  2155  	kfree(fcs_hba_attr);
7ba45b2cf0939bf6 Lee Jones          2021-02-25  2156  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2157  	return len;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2158  }
a36c61f9025b8924 Krishna Gudipati   2010-09-15  2159  

:::::: The code at line 1912 was first introduced by commit
:::::: 7ba45b2cf0939bf6cb07165d291ab1ae85f2c426 scsi: bfa: bfa_fcs_lport: Move a large struct from the stack onto the heap

:::::: TO: Lee Jones <lee.jones@linaro.org>
:::::: CC: Lee Jones <lee.jones@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38518 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [lee-linaro:tb-fix-w1-warnings 215/226] drivers/scsi/bfa/bfa_fcs_lport.c:1912 bfa_fcs_lport_fdmi_build_rhba_pyld() warn: signedness bug returning '(-12)'
@ 2021-02-27  9:32 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-02-27  9:32 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2811 bytes --]

Hi Lee,

First bad commit (maybe != root cause):

tree:   https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head:   49fe493a5f7cebaec70944df919df3350d4cb520
commit: ffdcc79844033bab9aae2f65246b91334831ee11 [215/226] fixup! scsi: bfa: bfa_fcs_lport: Move a large struct from the stack onto the heap
config: xtensa-randconfig-m031-20210227 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/scsi/bfa/bfa_fcs_lport.c:1912 bfa_fcs_lport_fdmi_build_rhba_pyld() warn: signedness bug returning '(-12)'

vim +1912 drivers/scsi/bfa/bfa_fcs_lport.c

a36c61f9025b8924 Krishna Gudipati   2010-09-15  1899  static          u16
                                                                      ^^^

a36c61f9025b8924 Krishna Gudipati   2010-09-15  1900  bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1901  {
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1902  	struct bfa_fcs_lport_s *port = fdmi->ms->port;
ffdcc79844033bab Lee Jones          2021-02-26  1903  	struct bfa_fcs_fdmi_hba_attr_s *fcs_hba_attr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1904  	struct fdmi_rhba_s *rhba = (struct fdmi_rhba_s *) pyld;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1905  	struct fdmi_attr_s *attr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1906  	u8        *curr_ptr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1907  	u16        len, count;
50444a340028119c Maggie             2010-11-29  1908  	u16	templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1909  
ffdcc79844033bab Lee Jones          2021-02-26  1910  	fcs_hba_attr = kzalloc(sizeof(*fcs_hba_attr), GFP_KERNEL);
ffdcc79844033bab Lee Jones          2021-02-26  1911  	if (!fcs_hba_attr)
7ba45b2cf0939bf6 Lee Jones          2021-02-25 @1912  		return -ENOMEM;
                                                                ^^^^^^^^^^^^^^^
-ENOMEM gets truncated to u16

7ba45b2cf0939bf6 Lee Jones          2021-02-25  1913  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1914  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1915  	 * get hba attributes
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1916  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1917  	bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1918  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1919  	rhba->hba_id = bfa_fcs_lport_get_pwwn(port);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38518 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [lee-linaro:tb-fix-w1-warnings 215/226] drivers/scsi/bfa/bfa_fcs_lport.c:1912 bfa_fcs_lport_fdmi_build_rhba_pyld() warn: signedness bug returning '(-12)'
@ 2021-02-27  9:32 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-02-27  9:32 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2811 bytes --]

Hi Lee,

First bad commit (maybe != root cause):

tree:   https://git.linaro.org/people/lee.jones/linux.git tb-fix-w1-warnings
head:   49fe493a5f7cebaec70944df919df3350d4cb520
commit: ffdcc79844033bab9aae2f65246b91334831ee11 [215/226] fixup! scsi: bfa: bfa_fcs_lport: Move a large struct from the stack onto the heap
config: xtensa-randconfig-m031-20210227 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/scsi/bfa/bfa_fcs_lport.c:1912 bfa_fcs_lport_fdmi_build_rhba_pyld() warn: signedness bug returning '(-12)'

vim +1912 drivers/scsi/bfa/bfa_fcs_lport.c

a36c61f9025b8924 Krishna Gudipati   2010-09-15  1899  static          u16
                                                                      ^^^

a36c61f9025b8924 Krishna Gudipati   2010-09-15  1900  bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1901  {
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1902  	struct bfa_fcs_lport_s *port = fdmi->ms->port;
ffdcc79844033bab Lee Jones          2021-02-26  1903  	struct bfa_fcs_fdmi_hba_attr_s *fcs_hba_attr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1904  	struct fdmi_rhba_s *rhba = (struct fdmi_rhba_s *) pyld;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1905  	struct fdmi_attr_s *attr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1906  	u8        *curr_ptr;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1907  	u16        len, count;
50444a340028119c Maggie             2010-11-29  1908  	u16	templen;
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1909  
ffdcc79844033bab Lee Jones          2021-02-26  1910  	fcs_hba_attr = kzalloc(sizeof(*fcs_hba_attr), GFP_KERNEL);
ffdcc79844033bab Lee Jones          2021-02-26  1911  	if (!fcs_hba_attr)
7ba45b2cf0939bf6 Lee Jones          2021-02-25 @1912  		return -ENOMEM;
                                                                ^^^^^^^^^^^^^^^
-ENOMEM gets truncated to u16

7ba45b2cf0939bf6 Lee Jones          2021-02-25  1913  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1914  	/*
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1915  	 * get hba attributes
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1916  	 */
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1917  	bfa_fcs_fdmi_get_hbaattr(fdmi, fcs_hba_attr);
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1918  
a36c61f9025b8924 Krishna Gudipati   2010-09-15  1919  	rhba->hba_id = bfa_fcs_lport_get_pwwn(port);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38518 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-27  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-27  9:32 [lee-linaro:tb-fix-w1-warnings 215/226] drivers/scsi/bfa/bfa_fcs_lport.c:1912 bfa_fcs_lport_fdmi_build_rhba_pyld() warn: signedness bug returning '(-12)' Dan Carpenter
2021-02-27  9:32 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-02-27  0:30 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.