All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Gerhard Engleder <gerhard@engleder-embedded.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.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
Date: Wed, 18 Oct 2023 20:54:04 +0800	[thread overview]
Message-ID: <202310182028.vmDthIUa-lkp@intel.com> (raw)

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@intel.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

                 reply	other threads:[~2023-10-18 12:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202310182028.vmDthIUa-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gerhard@engleder-embedded.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.