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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202311190448.wkvrT5iZ-lkp@intel.com>
Date:   Sun, 19 Nov 2023 04:18:47 +0800
From:   kernel test robot <lkp@...el.com>
To:     Sreekanth Reddy <sreekanth.reddy@...gotech.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Christoph Hellwig <hch@....de>, Hannes Reinecke <hare@...e.de>
Subject: drivers/scsi/mpt3sas/mpt3sas_base.c:257:57: warning: '%s' directive
 output may be truncated writing up to 31 bytes into a region of size 15

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   05aa69b096a089dc85391e36ccdce76961694e22
commit: c84b06a48c4d8ac8270624453132f3fa1a4a0f9d mpt3sas: Single driver module which supports both SAS 2.0 & SAS 3.0 HBAs
date:   8 years ago
config: x86_64-randconfig-r021-20230729 (https://download.01.org/0day-ci/archive/20231119/202311190448.wkvrT5iZ-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/20231119/202311190448.wkvrT5iZ-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/202311190448.wkvrT5iZ-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/kobject.h:21,
                    from include/linux/module.h:17,
                    from drivers/scsi/mpt3sas/mpt3sas_base.c:47:
   include/linux/sysfs.h: In function 'sysfs_get_dirent':
   include/linux/sysfs.h:496:44: warning: pointer targets in passing argument 2 of 'kernfs_find_and_get' differ in signedness [-Wpointer-sign]
     496 |         return kernfs_find_and_get(parent, name);
         |                                            ^~~~
         |                                            |
         |                                            const unsigned char *
   In file included from include/linux/sysfs.h:15:
   include/linux/kernfs.h:428:57: note: expected 'const char *' but argument is of type 'const unsigned char *'
     428 | kernfs_find_and_get(struct kernfs_node *kn, const char *name)
         |                                             ~~~~~~~~~~~~^~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_display_event_data':
   drivers/scsi/mpt3sas/mpt3sas_base.c:610:17: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     610 |                 if (event_data->DiscoveryStatus)
         |                 ^~
   In file included from include/linux/kernel.h:13,
                    from drivers/scsi/mpt3sas/mpt3sas_base.c:46:
   include/linux/printk.h:259:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
     259 |         printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:613:25: note: in expansion of macro 'pr_info'
     613 |                         pr_info("\n");
         |                         ^~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: At top level:
   drivers/scsi/mpt3sas/mpt3sas_base.c:2013:1: warning: no previous declaration for 'mpt3sas_base_unmap_resources' [-Wmissing-declarations]
    2013 | mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_display_ioc_capabilities':
   drivers/scsi/mpt3sas/mpt3sas_base.c:2789:36: warning: pointer targets in passing argument 2 of 'strncpy' differ in signedness [-Wpointer-sign]
    2789 |         strncpy(desc, ioc->manu_pg0.ChipName, 16);
         |                       ~~~~~~~~~~~~~^~~~~~~~~
         |                                    |
         |                                    U8 * {aka unsigned char *}
   In file included from include/linux/dynamic_debug.h:111,
                    from include/linux/printk.h:277:
   include/linux/string.h:23:30: note: expected 'const char *' but argument is of type 'U8 *' {aka 'unsigned char *'}
      23 | extern char * strncpy(char *,const char *, __kernel_size_t);
         |                              ^~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_handshake_req_reply_wait':
   drivers/scsi/mpt3sas/mpt3sas_base.c:3819:13: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
    3819 |         u16 dummy;
         |             ^~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_sas_iounit_control':
   drivers/scsi/mpt3sas/mpt3sas_base.c:3944:23: warning: variable 'timeleft' set but not used [-Wunused-but-set-variable]
    3944 |         unsigned long timeleft;
         |                       ^~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_scsi_enclosure_processor':
   drivers/scsi/mpt3sas/mpt3sas_base.c:4048:23: warning: variable 'timeleft' set but not used [-Wunused-but-set-variable]
    4048 |         unsigned long timeleft;
         |                       ^~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_send_port_enable':
   drivers/scsi/mpt3sas/mpt3sas_base.c:4490:23: warning: variable 'timeleft' set but not used [-Wunused-but-set-variable]
    4490 |         unsigned long timeleft;
         |                       ^~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_event_notification':
   drivers/scsi/mpt3sas/mpt3sas_base.c:4671:23: warning: variable 'timeleft' set but not used [-Wunused-but-set-variable]
    4671 |         unsigned long timeleft;
         |                       ^~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_display_OEMs_branding':
   drivers/scsi/mpt3sas/mpt3sas_base.c:2530:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
    2530 |                         switch (ioc->pdev->subsystem_device) {
         |                         ^~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:2549:17: note: here
    2549 |                 case MPI2_MFGPAGE_DEVID_SAS2308_2:
         |                 ^~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:2550:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
    2550 |                         switch (ioc->pdev->subsystem_device) {
         |                         ^~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:2585:17: note: here
    2585 |                 case MPI25_MFGPAGE_DEVID_SAS3008:
         |                 ^~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:2728:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
    2728 |                         switch (ioc->pdev->subsystem_device) {
         |                         ^~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:2739:17: note: here
    2739 |                 case MPI2_MFGPAGE_DEVID_SAS2308_2:
         |                 ^~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:2740:25: warning: this statement may fall through [-Wimplicit-fallthrough=]
    2740 |                         switch (ioc->pdev->subsystem_device) {
         |                         ^~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:2763:17: note: here
    2763 |                 default:
         |                 ^~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_start_watchdog':
>> drivers/scsi/mpt3sas/mpt3sas_base.c:257:57: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 15 [-Wformat-truncation=]
     257 |             sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
         |                                                         ^~
   drivers/scsi/mpt3sas/mpt3sas_base.c:257:51: note: directive argument in the range [0, 255]
     257 |             sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
         |                                                   ^~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:256:9: note: 'snprintf' output between 14 and 47 bytes into a destination of size 20
     256 |         snprintf(ioc->fault_reset_work_q_name,
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     257 |             sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     258 |             ioc->driver_name, ioc->id);
         |             ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_map_resources':
   drivers/scsi/mpt3sas/mpt3sas_base.c:1841:61: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 1 and 32 [-Wformat-truncation=]
    1841 |                 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d",
         |                                                             ^~
   In function '_base_request_irq',
       inlined from '_base_enable_msix' at drivers/scsi/mpt3sas/mpt3sas_base.c:2003:6,
       inlined from 'mpt3sas_base_map_resources' at drivers/scsi/mpt3sas/mpt3sas_base.c:2124:6:
   drivers/scsi/mpt3sas/mpt3sas_base.c:1841:58: note: directive argument in the range [0, 255]
    1841 |                 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d",
         |                                                          ^~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:1841:17: note: 'snprintf' output between 2 and 35 bytes into a destination of size 32
    1841 |                 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d",
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1842 |                     ioc->driver_name, ioc->id);
         |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c: In function 'mpt3sas_base_map_resources':
   drivers/scsi/mpt3sas/mpt3sas_base.c:1838:61: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 1 and 32 [-Wformat-truncation=]
    1838 |                 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
         |                                                             ^~
   In function '_base_request_irq',
       inlined from '_base_enable_msix' at drivers/scsi/mpt3sas/mpt3sas_base.c:2003:6,
       inlined from 'mpt3sas_base_map_resources' at drivers/scsi/mpt3sas/mpt3sas_base.c:2124:6:
   drivers/scsi/mpt3sas/mpt3sas_base.c:1838:58: note: directive argument in the range [0, 255]
    1838 |                 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
         |                                                          ^~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:1838:17: note: 'snprintf' output between 8 and 41 bytes into a destination of size 32
    1838 |                 snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d",
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1839 |                     ioc->driver_name, ioc->id, index);
         |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_base.c:104: warning: Function parameter or member 'val' not described in '_scsih_set_fwfault_debug'
   drivers/scsi/mpt3sas/mpt3sas_base.c:104: warning: Function parameter or member 'kp' not described in '_scsih_set_fwfault_debug'
   drivers/scsi/mpt3sas/mpt3sas_base.c:928: warning: Excess function parameter 'r' description in '_base_interrupt'
   drivers/scsi/mpt3sas/mpt3sas_base.c:2397: warning: Excess function parameter 'ioc' description in '_base_writeq'
   drivers/scsi/mpt3sas/mpt3sas_base.c:3594: warning: Function parameter or member 'ioc' not described in '_base_wait_on_iocstate'
   drivers/scsi/mpt3sas/mpt3sas_base.c:3628: warning: expecting prototype for _base_wait_for_doorbell_int(). Prototype was for _base_diag_reset() instead
   drivers/scsi/mpt3sas/mpt3sas_base.c:4138: warning: Function parameter or member 'port' not described in '_base_get_port_facts'
   drivers/scsi/mpt3sas/mpt3sas_base.c:4730: warning: Function parameter or member 'event_type' not described in 'mpt3sas_base_validate_event_type'
   drivers/scsi/mpt3sas/mpt3sas_base.c:4730: warning: Excess function parameter 'event' description in 'mpt3sas_base_validate_event_type'


vim +257 drivers/scsi/mpt3sas/mpt3sas_base.c

   237	
   238	/**
   239	 * mpt3sas_base_start_watchdog - start the fault_reset_work_q
   240	 * @ioc: per adapter object
   241	 * Context: sleep.
   242	 *
   243	 * Return nothing.
   244	 */
   245	void
   246	mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc)
   247	{
   248		unsigned long	 flags;
   249	
   250		if (ioc->fault_reset_work_q)
   251			return;
   252	
   253		/* initialize fault polling */
   254	
   255		INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work);
   256		snprintf(ioc->fault_reset_work_q_name,
 > 257		    sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status",
   258		    ioc->driver_name, ioc->id);
   259		ioc->fault_reset_work_q =
   260			create_singlethread_workqueue(ioc->fault_reset_work_q_name);
   261		if (!ioc->fault_reset_work_q) {
   262			pr_err(MPT3SAS_FMT "%s: failed (line=%d)\n",
   263			    ioc->name, __func__, __LINE__);
   264				return;
   265		}
   266		spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
   267		if (ioc->fault_reset_work_q)
   268			queue_delayed_work(ioc->fault_reset_work_q,
   269			    &ioc->fault_reset_work,
   270			    msecs_to_jiffies(FAULT_POLLING_INTERVAL));
   271		spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
   272	}
   273	

-- 
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