All of lore.kernel.org
 help / color / mirror / Atom feed
* [kees:kspp/alloc_size/v5.15-rc2-v2 4/9] drivers/edac/thunderx_edac.c:1899:17: warning: 'strncat' specified bound 1024 equals destination size
@ 2021-10-11 21:54 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-10-11 21:54 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Kees Cook <keescook@chromium.org>
CC: Daniel Micay <danielmicay@gmail.com>
CC: Nick Desaulniers <ndesaulniers@google.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git kspp/alloc_size/v5.15-rc2-v2
head:   814dd7d0f6cb6a824de253a90937cda4236f3aad
commit: 77cded22dabc36a3681d049108cce24b18b312c9 [4/9] slab: Add __alloc_size attributes for better bounds checking
:::::: branch date: 6 days ago
:::::: commit date: 11 days ago
config: arm64-randconfig-s032-20211011 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?id=77cded22dabc36a3681d049108cce24b18b312c9
        git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
        git fetch --no-tags kees kspp/alloc_size/v5.15-rc2-v2
        git checkout 77cded22dabc36a3681d049108cce24b18b312c9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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

All warnings (new ones prefixed by >>):

   drivers/edac/thunderx_edac.c: In function 'thunderx_l2c_threaded_isr':
>> drivers/edac/thunderx_edac.c:1899:17: warning: 'strncat' specified bound 1024 equals destination size [-Wstringop-truncation]
    1899 |                 strncat(msg, other, L2C_MESSAGE_SIZE);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/edac/thunderx_edac.c: In function 'thunderx_ocx_lnk_threaded_isr':
   drivers/edac/thunderx_edac.c:1220:17: warning: 'strncat' specified bound 1024 equals destination size [-Wstringop-truncation]
    1220 |                 strncat(msg, other, OCX_MESSAGE_SIZE);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/edac/thunderx_edac.c: In function 'thunderx_ocx_com_threaded_isr':
   drivers/edac/thunderx_edac.c:1136:17: warning: 'strncat' specified bound 1024 equals destination size [-Wstringop-truncation]
    1136 |                 strncat(msg, other, OCX_MESSAGE_SIZE);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/edac/thunderx_edac.c:1145:33: warning: 'strncat' specified bound 1024 equals destination size [-Wstringop-truncation]
    1145 |                                 strncat(msg, other, OCX_MESSAGE_SIZE);
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/edac/thunderx_edac.c:1150:33: warning: 'strncat' specified bound 1024 equals destination size [-Wstringop-truncation]
    1150 |                                 strncat(msg, other, OCX_MESSAGE_SIZE);
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncat +1899 drivers/edac/thunderx_edac.c

41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1841  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1842  static irqreturn_t thunderx_l2c_threaded_isr(int irq, void *irq_id)
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1843  {
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1844  	struct msix_entry *msix = irq_id;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1845  	struct thunderx_l2c *l2c = container_of(msix, struct thunderx_l2c,
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1846  						msix_ent);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1847  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1848  	unsigned long tail = ring_pos(l2c->ring_tail, ARRAY_SIZE(l2c->err_ctx));
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1849  	struct l2c_err_ctx *ctx = &l2c->err_ctx[tail];
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1850  	irqreturn_t ret = IRQ_NONE;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1851  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1852  	u64 mask_ue, mask_ce;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1853  	const struct error_descr *l2_errors;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1854  	char *reg_int_name;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1855  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1856  	char *msg;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1857  	char *other;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1858  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1859  	msg = kmalloc(OCX_MESSAGE_SIZE, GFP_KERNEL);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1860  	other = kmalloc(OCX_OTHER_SIZE, GFP_KERNEL);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1861  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1862  	if (!msg || !other)
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1863  		goto err_free;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1864  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1865  	switch (l2c->pdev->device) {
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1866  	case PCI_DEVICE_ID_THUNDER_L2C_TAD:
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1867  		reg_int_name = "L2C_TAD_INT";
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1868  		mask_ue = L2C_TAD_INT_UE;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1869  		mask_ce = L2C_TAD_INT_CE;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1870  		l2_errors = l2_tad_errors;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1871  		break;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1872  	case PCI_DEVICE_ID_THUNDER_L2C_CBC:
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1873  		reg_int_name = "L2C_CBC_INT";
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1874  		mask_ue = L2C_CBC_INT_UE;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1875  		mask_ce = L2C_CBC_INT_CE;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1876  		l2_errors = l2_cbc_errors;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1877  		break;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1878  	case PCI_DEVICE_ID_THUNDER_L2C_MCI:
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1879  		reg_int_name = "L2C_MCI_INT";
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1880  		mask_ue = L2C_MCI_INT_VBFDBE;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1881  		mask_ce = L2C_MCI_INT_VBFSBE;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1882  		l2_errors = l2_mci_errors;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1883  		break;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1884  	default:
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1885  		dev_err(&l2c->pdev->dev, "Unsupported device: %04x\n",
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1886  			l2c->pdev->device);
d8c27ba86a2fd806 Dan Carpenter      2018-10-13  1887  		goto err_free;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1888  	}
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1889  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1890  	while (CIRC_CNT(l2c->ring_head, l2c->ring_tail,
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1891  			ARRAY_SIZE(l2c->err_ctx))) {
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1892  		snprintf(msg, L2C_MESSAGE_SIZE,
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1893  			 "%s: %s: %016llx, %s: %016llx",
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1894  			 l2c->edac_dev->ctl_name, reg_int_name, ctx->reg_int,
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1895  			 ctx->reg_ext_name, ctx->reg_ext);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1896  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1897  		decode_register(other, L2C_OTHER_SIZE, l2_errors, ctx->reg_int);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1898  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24 @1899  		strncat(msg, other, L2C_MESSAGE_SIZE);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1900  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1901  		if (ctx->reg_int & mask_ue)
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1902  			edac_device_handle_ue(l2c->edac_dev, 0, 0, msg);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1903  		else if (ctx->reg_int & mask_ce)
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1904  			edac_device_handle_ce(l2c->edac_dev, 0, 0, msg);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1905  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1906  		l2c->ring_tail++;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1907  	}
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1908  
d8c27ba86a2fd806 Dan Carpenter      2018-10-13  1909  	ret = IRQ_HANDLED;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1910  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1911  err_free:
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1912  	kfree(other);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1913  	kfree(msg);
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1914  
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1915  	return ret;
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1916  }
41003396f932d7f0 Sergey Temerkhanov 2017-03-24  1917  

:::::: The code at line 1899 was first introduced by commit
:::::: 41003396f932d7f027725c7acebb6a7caa41dc3e EDAC, thunderx: Add Cavium ThunderX EDAC driver

:::::: TO: Sergey Temerkhanov <s.temerkhanov@gmail.com>
:::::: CC: Borislav Petkov <bp@suse.de>

---
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: 36343 bytes --]

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

only message in thread, other threads:[~2021-10-11 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 21:54 [kees:kspp/alloc_size/v5.15-rc2-v2 4/9] drivers/edac/thunderx_edac.c:1899:17: warning: 'strncat' specified bound 1024 equals destination size 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.