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>] [day] [month] [year] [list]
Message-ID: <202111131026.Yo15go3d-lkp@intel.com>
Date:   Sat, 13 Nov 2021 10:50:35 +0800
From:   kernel test robot <lkp@...el.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Daniel Micay <danielmicay@...il.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: drivers/edac/thunderx_edac.c:1220:17: warning: 'strncat' specified
 bound 1024 equals destination size

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   66f4beaa6c1d28161f534471484b2daa2de1dce0
commit: c37495d6254c237578db3121dcf79857e033f8ff slab: add __alloc_size attributes for better bounds checking
date:   6 days ago
config: arm64-buildonly-randconfig-r001-20211111 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c37495d6254c237578db3121dcf79857e033f8ff
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c37495d6254c237578db3121dcf79857e033f8ff
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

   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);
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

41003396f932d7 Sergey Temerkhanov 2017-03-24  1186  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1187  static irqreturn_t thunderx_ocx_lnk_threaded_isr(int irq, void *irq_id)
41003396f932d7 Sergey Temerkhanov 2017-03-24  1188  {
41003396f932d7 Sergey Temerkhanov 2017-03-24  1189  	struct msix_entry *msix = irq_id;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1190  	struct thunderx_ocx *ocx = container_of(msix, struct thunderx_ocx,
41003396f932d7 Sergey Temerkhanov 2017-03-24  1191  						msix_ent[msix->entry]);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1192  	irqreturn_t ret = IRQ_NONE;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1193  	unsigned long tail;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1194  	struct ocx_link_err_ctx *ctx;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1195  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1196  	char *msg;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1197  	char *other;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1198  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1199  	msg = kmalloc(OCX_MESSAGE_SIZE, GFP_KERNEL);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1200  	other = kmalloc(OCX_OTHER_SIZE, GFP_KERNEL);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1201  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1202  	if (!msg || !other)
41003396f932d7 Sergey Temerkhanov 2017-03-24  1203  		goto err_free;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1204  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1205  	while (CIRC_CNT(ocx->link_ring_head, ocx->link_ring_tail,
41003396f932d7 Sergey Temerkhanov 2017-03-24  1206  			ARRAY_SIZE(ocx->link_err_ctx))) {
41003396f932d7 Sergey Temerkhanov 2017-03-24  1207  		tail = ring_pos(ocx->link_ring_head,
41003396f932d7 Sergey Temerkhanov 2017-03-24  1208  				ARRAY_SIZE(ocx->link_err_ctx));
41003396f932d7 Sergey Temerkhanov 2017-03-24  1209  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1210  		ctx = &ocx->link_err_ctx[tail];
41003396f932d7 Sergey Temerkhanov 2017-03-24  1211  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1212  		snprintf(msg, OCX_MESSAGE_SIZE,
41003396f932d7 Sergey Temerkhanov 2017-03-24  1213  			 "%s: OCX_COM_LINK_INT[%d]: %016llx",
41003396f932d7 Sergey Temerkhanov 2017-03-24  1214  			 ocx->edac_dev->ctl_name,
41003396f932d7 Sergey Temerkhanov 2017-03-24  1215  			 ctx->link, ctx->reg_com_link_int);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1216  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1217  		decode_register(other, OCX_OTHER_SIZE,
41003396f932d7 Sergey Temerkhanov 2017-03-24  1218  				ocx_com_link_errors, ctx->reg_com_link_int);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1219  
41003396f932d7 Sergey Temerkhanov 2017-03-24 @1220  		strncat(msg, other, OCX_MESSAGE_SIZE);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1221  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1222  		if (ctx->reg_com_link_int & OCX_COM_LINK_INT_UE)
41003396f932d7 Sergey Temerkhanov 2017-03-24  1223  			edac_device_handle_ue(ocx->edac_dev, 0, 0, msg);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1224  		else if (ctx->reg_com_link_int & OCX_COM_LINK_INT_CE)
41003396f932d7 Sergey Temerkhanov 2017-03-24  1225  			edac_device_handle_ce(ocx->edac_dev, 0, 0, msg);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1226  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1227  		ocx->link_ring_tail++;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1228  	}
41003396f932d7 Sergey Temerkhanov 2017-03-24  1229  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1230  	ret = IRQ_HANDLED;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1231  err_free:
41003396f932d7 Sergey Temerkhanov 2017-03-24  1232  	kfree(other);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1233  	kfree(msg);
41003396f932d7 Sergey Temerkhanov 2017-03-24  1234  
41003396f932d7 Sergey Temerkhanov 2017-03-24  1235  	return ret;
41003396f932d7 Sergey Temerkhanov 2017-03-24  1236  }
41003396f932d7 Sergey Temerkhanov 2017-03-24  1237  

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

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

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ