Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Tomas Henzl <thenzl@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [mkp-scsi:queue 51/51] drivers/scsi/mpi3mr/mpi3mr_transport.c:1370:11: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int'
Date: Sun, 12 May 2024 10:22:20 +0800	[thread overview]
Message-ID: <202405121016.0E6ufbnh-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git queue
head:   3668651def2c1622904e58b0280ee93121f2b10b
commit: 3668651def2c1622904e58b0280ee93121f2b10b [51/51] scsi: mpi3mr: Sanitise num_phys
config: i386-randconfig-005-20240512 (https://download.01.org/0day-ci/archive/20240512/202405121016.0E6ufbnh-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240512/202405121016.0E6ufbnh-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/202405121016.0E6ufbnh-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/scsi/mpi3mr/mpi3mr_transport.c:1370:11: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
    1369 |                         ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
         |                                                                                 ~~~
         |                                                                                 %u
    1370 |                             i, sizeof(mr_sas_port->phy_mask) * 8);
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/mpi3mr/mpi3mr_debug.h:46:37: note: expanded from macro 'ioc_warn'
      46 |         pr_warn("%s: " fmt, (ioc)->name, ##__VA_ARGS__)
         |                        ~~~                 ^~~~~~~~~~~
   include/linux/printk.h:510:37: note: expanded from macro 'pr_warn'
     510 |         printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
         |                                    ~~~     ^~~~~~~~~~~
   include/linux/printk.h:457:60: note: expanded from macro 'printk'
     457 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                     ~~~    ^~~~~~~~~~~
   include/linux/printk.h:429:19: note: expanded from macro 'printk_index_wrap'
     429 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                         ~~~~    ^~~~~~~~~~~
   1 warning generated.


vim +1370 drivers/scsi/mpi3mr/mpi3mr_transport.c

  1291	
  1292	/**
  1293	 * mpi3mr_sas_port_add - Expose the SAS device to the SAS TL
  1294	 * @mrioc: Adapter instance reference
  1295	 * @handle: Firmware device handle of the attached device
  1296	 * @sas_address_parent: sas address of parent expander or host
  1297	 * @hba_port: HBA port entry
  1298	 *
  1299	 * This function creates a new sas port object for the given end
  1300	 * device matching sas address and hba_port and adds it to the
  1301	 * sas_node's sas_port_list and expose the attached sas device
  1302	 * to the SAS transport layer through sas_rphy_add.
  1303	 *
  1304	 * Returns a valid mpi3mr_sas_port reference or NULL.
  1305	 */
  1306	static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
  1307		u16 handle, u64 sas_address_parent, struct mpi3mr_hba_port *hba_port)
  1308	{
  1309		struct mpi3mr_sas_phy *mr_sas_phy, *next;
  1310		struct mpi3mr_sas_port *mr_sas_port;
  1311		unsigned long flags;
  1312		struct mpi3mr_sas_node *mr_sas_node;
  1313		struct sas_rphy *rphy;
  1314		struct mpi3mr_tgt_dev *tgtdev = NULL;
  1315		int i;
  1316		struct sas_port *port;
  1317	
  1318		if (!hba_port) {
  1319			ioc_err(mrioc, "failure at %s:%d/%s()!\n",
  1320			    __FILE__, __LINE__, __func__);
  1321			return NULL;
  1322		}
  1323	
  1324		mr_sas_port = kzalloc(sizeof(struct mpi3mr_sas_port), GFP_KERNEL);
  1325		if (!mr_sas_port)
  1326			return NULL;
  1327	
  1328		INIT_LIST_HEAD(&mr_sas_port->port_list);
  1329		INIT_LIST_HEAD(&mr_sas_port->phy_list);
  1330		spin_lock_irqsave(&mrioc->sas_node_lock, flags);
  1331		mr_sas_node = __mpi3mr_sas_node_find_by_sas_address(mrioc,
  1332		    sas_address_parent, hba_port);
  1333		spin_unlock_irqrestore(&mrioc->sas_node_lock, flags);
  1334	
  1335		if (!mr_sas_node) {
  1336			ioc_err(mrioc, "%s:could not find parent sas_address(0x%016llx)!\n",
  1337			    __func__, (unsigned long long)sas_address_parent);
  1338			goto out_fail;
  1339		}
  1340	
  1341		if ((mpi3mr_set_identify(mrioc, handle,
  1342		    &mr_sas_port->remote_identify))) {
  1343			ioc_err(mrioc,  "failure at %s:%d/%s()!\n",
  1344			    __FILE__, __LINE__, __func__);
  1345			goto out_fail;
  1346		}
  1347	
  1348		if (mr_sas_port->remote_identify.device_type == SAS_PHY_UNUSED) {
  1349			ioc_err(mrioc, "failure at %s:%d/%s()!\n",
  1350			    __FILE__, __LINE__, __func__);
  1351			goto out_fail;
  1352		}
  1353	
  1354		mr_sas_port->hba_port = hba_port;
  1355		mpi3mr_sas_port_sanity_check(mrioc, mr_sas_node,
  1356		    mr_sas_port->remote_identify.sas_address, hba_port);
  1357	
  1358		if (mr_sas_node->num_phys > sizeof(mr_sas_port->phy_mask) * 8)
  1359			ioc_info(mrioc, "max port count %u could be too high\n",
  1360			    mr_sas_node->num_phys);
  1361	
  1362		for (i = 0; i < mr_sas_node->num_phys; i++) {
  1363			if ((mr_sas_node->phy[i].remote_identify.sas_address !=
  1364			    mr_sas_port->remote_identify.sas_address) ||
  1365			    (mr_sas_node->phy[i].hba_port != hba_port))
  1366				continue;
  1367	
  1368			if (i > sizeof(mr_sas_port->phy_mask) * 8) {
  1369				ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
> 1370				    i, sizeof(mr_sas_port->phy_mask) * 8);
  1371				goto out_fail;
  1372			}
  1373			list_add_tail(&mr_sas_node->phy[i].port_siblings,
  1374			    &mr_sas_port->phy_list);
  1375			mr_sas_port->num_phys++;
  1376			mr_sas_port->phy_mask |= (1 << i);
  1377		}
  1378	
  1379		if (!mr_sas_port->num_phys) {
  1380			ioc_err(mrioc, "failure at %s:%d/%s()!\n",
  1381			    __FILE__, __LINE__, __func__);
  1382			goto out_fail;
  1383		}
  1384	
  1385		mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
  1386	
  1387		if (mr_sas_port->remote_identify.device_type == SAS_END_DEVICE) {
  1388			tgtdev = mpi3mr_get_tgtdev_by_addr(mrioc,
  1389			    mr_sas_port->remote_identify.sas_address,
  1390			    mr_sas_port->hba_port);
  1391	
  1392			if (!tgtdev) {
  1393				ioc_err(mrioc, "failure at %s:%d/%s()!\n",
  1394				    __FILE__, __LINE__, __func__);
  1395				goto out_fail;
  1396			}
  1397			tgtdev->dev_spec.sas_sata_inf.pend_sas_rphy_add = 1;
  1398		}
  1399	
  1400		if (!mr_sas_node->parent_dev) {
  1401			ioc_err(mrioc, "failure at %s:%d/%s()!\n",
  1402			    __FILE__, __LINE__, __func__);
  1403			goto out_fail;
  1404		}
  1405	
  1406		port = sas_port_alloc_num(mr_sas_node->parent_dev);
  1407		if ((sas_port_add(port))) {
  1408			ioc_err(mrioc, "failure at %s:%d/%s()!\n",
  1409			    __FILE__, __LINE__, __func__);
  1410			goto out_fail;
  1411		}
  1412	
  1413		list_for_each_entry(mr_sas_phy, &mr_sas_port->phy_list,
  1414		    port_siblings) {
  1415			if ((mrioc->logging_level & MPI3_DEBUG_TRANSPORT_INFO))
  1416				dev_info(&port->dev,
  1417				    "add: handle(0x%04x), sas_address(0x%016llx), phy(%d)\n",
  1418				    handle, (unsigned long long)
  1419				    mr_sas_port->remote_identify.sas_address,
  1420				    mr_sas_phy->phy_id);
  1421			sas_port_add_phy(port, mr_sas_phy->phy);
  1422			mr_sas_phy->phy_belongs_to_port = 1;
  1423			mr_sas_phy->hba_port = hba_port;
  1424		}
  1425	
  1426		mr_sas_port->port = port;
  1427		if (mr_sas_port->remote_identify.device_type == SAS_END_DEVICE) {
  1428			rphy = sas_end_device_alloc(port);
  1429			tgtdev->dev_spec.sas_sata_inf.rphy = rphy;
  1430		} else {
  1431			rphy = sas_expander_alloc(port,
  1432			    mr_sas_port->remote_identify.device_type);
  1433		}
  1434		rphy->identify = mr_sas_port->remote_identify;
  1435	
  1436		if (mrioc->current_event)
  1437			mrioc->current_event->pending_at_sml = 1;
  1438	
  1439		if ((sas_rphy_add(rphy))) {
  1440			ioc_err(mrioc, "failure at %s:%d/%s()!\n",
  1441			    __FILE__, __LINE__, __func__);
  1442		}
  1443		if (mr_sas_port->remote_identify.device_type == SAS_END_DEVICE) {
  1444			tgtdev->dev_spec.sas_sata_inf.pend_sas_rphy_add = 0;
  1445			tgtdev->dev_spec.sas_sata_inf.sas_transport_attached = 1;
  1446			mpi3mr_tgtdev_put(tgtdev);
  1447		}
  1448	
  1449		dev_info(&rphy->dev,
  1450		    "%s: added: handle(0x%04x), sas_address(0x%016llx)\n",
  1451		    __func__, handle, (unsigned long long)
  1452		    mr_sas_port->remote_identify.sas_address);
  1453	
  1454		mr_sas_port->rphy = rphy;
  1455		spin_lock_irqsave(&mrioc->sas_node_lock, flags);
  1456		list_add_tail(&mr_sas_port->port_list, &mr_sas_node->sas_port_list);
  1457		spin_unlock_irqrestore(&mrioc->sas_node_lock, flags);
  1458	
  1459		if (mrioc->current_event) {
  1460			mrioc->current_event->pending_at_sml = 0;
  1461			if (mrioc->current_event->discard)
  1462				mpi3mr_print_device_event_notice(mrioc, true);
  1463		}
  1464	
  1465		/* fill in report manufacture */
  1466		if (mr_sas_port->remote_identify.device_type ==
  1467		    SAS_EDGE_EXPANDER_DEVICE ||
  1468		    mr_sas_port->remote_identify.device_type ==
  1469		    SAS_FANOUT_EXPANDER_DEVICE)
  1470			mpi3mr_report_manufacture(mrioc,
  1471			    mr_sas_port->remote_identify.sas_address,
  1472			    rphy_to_expander_device(rphy), hba_port->port_id);
  1473	
  1474		return mr_sas_port;
  1475	
  1476	 out_fail:
  1477		list_for_each_entry_safe(mr_sas_phy, next, &mr_sas_port->phy_list,
  1478		    port_siblings)
  1479			list_del(&mr_sas_phy->port_siblings);
  1480		kfree(mr_sas_port);
  1481		return NULL;
  1482	}
  1483	

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

                 reply	other threads:[~2024-05-12  2:22 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=202405121016.0E6ufbnh-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=martin.petersen@oracle.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=thenzl@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).