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: <202310182028.vmDthIUa-lkp@intel.com>
Date:   Wed, 18 Oct 2023 20:54:04 +0800
From:   kernel test robot <lkp@...el.com>
To:     Gerhard Engleder <gerhard@...leder-embedded.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: drivers/net/ethernet/engleder/tsnep_main.c:884:55: warning:
 'sprintf' may write a terminating nul past the end of the destination

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   06dc10eae55b5ceabfef287a7e5f16ceea204aa0
commit: 58eaa8abe43a0c20e4b899d51f666393e95e4833 tsnep: Move interrupt from device to queue
date:   1 year, 1 month ago
config: x86_64-randconfig-071-20230917 (https://download.01.org/0day-ci/archive/20231018/202310182028.vmDthIUa-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/202310182028.vmDthIUa-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310182028.vmDthIUa-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/engleder/tsnep_main.c: In function 'tsnep_request_irq':
>> drivers/net/ethernet/engleder/tsnep_main.c:884:55: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
     884 |                         sprintf(queue->name, "%s-rx-%d", name,
         |                                                       ^
   drivers/net/ethernet/engleder/tsnep_main.c:884:25: note: 'sprintf' output between 6 and 36 bytes into a destination of size 25
     884 |                         sprintf(queue->name, "%s-rx-%d", name,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     885 |                                 queue->rx->queue_index);
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/engleder/tsnep_main.c:881:55: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
     881 |                         sprintf(queue->name, "%s-tx-%d", name,
         |                                                       ^
   drivers/net/ethernet/engleder/tsnep_main.c:881:25: note: 'sprintf' output between 6 and 36 bytes into a destination of size 25
     881 |                         sprintf(queue->name, "%s-tx-%d", name,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     882 |                                 queue->tx->queue_index);
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/engleder/tsnep_main.c:878:49: warning: '-txrx-' directive writing 6 bytes into a region of size between 5 and 25 [-Wformat-overflow=]
     878 |                         sprintf(queue->name, "%s-txrx-%d", name,
         |                                                 ^~~~~~
   drivers/net/ethernet/engleder/tsnep_main.c:878:25: note: 'sprintf' output between 8 and 38 bytes into a destination of size 25
     878 |                         sprintf(queue->name, "%s-txrx-%d", name,
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     879 |                                 queue->rx->queue_index);
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~


vim +/sprintf +884 drivers/net/ethernet/engleder/tsnep_main.c

   864	
   865	static int tsnep_request_irq(struct tsnep_queue *queue, bool first)
   866	{
   867		const char *name = netdev_name(queue->adapter->netdev);
   868		irq_handler_t handler;
   869		void *dev;
   870		int retval;
   871	
   872		if (first) {
   873			sprintf(queue->name, "%s-mac", name);
   874			handler = tsnep_irq;
   875			dev = queue->adapter;
   876		} else {
   877			if (queue->tx && queue->rx)
 > 878				sprintf(queue->name, "%s-txrx-%d", name,
   879					queue->rx->queue_index);
   880			else if (queue->tx)
   881				sprintf(queue->name, "%s-tx-%d", name,
   882					queue->tx->queue_index);
   883			else
 > 884				sprintf(queue->name, "%s-rx-%d", name,
   885					queue->rx->queue_index);
   886			handler = tsnep_irq_txrx;
   887			dev = queue;
   888		}
   889	
   890		retval = request_irq(queue->irq, handler, 0, queue->name, dev);
   891		if (retval) {
   892			/* if name is empty, then interrupt won't be freed */
   893			memset(queue->name, 0, sizeof(queue->name));
   894		}
   895	
   896		return retval;
   897	}
   898	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ