tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 15f539c4a521c5ae892554d0046e24f050ec0e00 commit: f04c0f3eb9b49427c273cd3e4d5a2ff895855b4b [2431/10661] make OPTIMIZE_INLINING config editable config: arm64-randconfig-003-20240711 (https://download.01.org/0day-ci/archive/20240712/202407120236.foVeyRg9-lkp@i...) compiler: aarch64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240712/202407120236.foVeyRg9-lkp@i...)
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/202407120236.foVeyRg9-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/char/virtio_console.c: In function 'add_port.isra':
drivers/char/virtio_console.c:1460:63: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size between 0 and 9 [-Wformat-truncation=]
1460 | snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u", | ^~ drivers/char/virtio_console.c:1460:54: note: directive argument in the range [0, 4294967294] 1460 | snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u", | ^~~~~~~~~~~~ drivers/char/virtio_console.c:1460:9: note: 'snprintf' output between 9 and 27 bytes into a destination of size 16 1460 | snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1461 | port->portdev->vdev->index, id); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1460 drivers/char/virtio_console.c
3eae0adea949d8 Amit Shah 2010-09-02 1354 c446f8fcc9fba3 Amit Shah 2010-05-19 1355 static int add_port(struct ports_device *portdev, u32 id) c446f8fcc9fba3 Amit Shah 2010-05-19 1356 { c446f8fcc9fba3 Amit Shah 2010-05-19 1357 char debugfs_name[16]; c446f8fcc9fba3 Amit Shah 2010-05-19 1358 struct port *port; c446f8fcc9fba3 Amit Shah 2010-05-19 1359 dev_t devt; c446f8fcc9fba3 Amit Shah 2010-05-19 1360 int err; c446f8fcc9fba3 Amit Shah 2010-05-19 1361 c446f8fcc9fba3 Amit Shah 2010-05-19 1362 port = kmalloc(sizeof(*port), GFP_KERNEL); c446f8fcc9fba3 Amit Shah 2010-05-19 1363 if (!port) { c446f8fcc9fba3 Amit Shah 2010-05-19 1364 err = -ENOMEM; c446f8fcc9fba3 Amit Shah 2010-05-19 1365 goto fail; c446f8fcc9fba3 Amit Shah 2010-05-19 1366 } b353a6b8216270 Amit Shah 2010-09-02 1367 kref_init(&port->kref); c446f8fcc9fba3 Amit Shah 2010-05-19 1368 c446f8fcc9fba3 Amit Shah 2010-05-19 1369 port->portdev = portdev; c446f8fcc9fba3 Amit Shah 2010-05-19 1370 port->id = id; c446f8fcc9fba3 Amit Shah 2010-05-19 1371 c446f8fcc9fba3 Amit Shah 2010-05-19 1372 port->name = NULL; c446f8fcc9fba3 Amit Shah 2010-05-19 1373 port->inbuf = NULL; c446f8fcc9fba3 Amit Shah 2010-05-19 1374 port->cons.hvc = NULL; 3eae0adea949d8 Amit Shah 2010-09-02 1375 port->async_queue = NULL; c446f8fcc9fba3 Amit Shah 2010-05-19 1376 9778829cffd4d8 Amit Shah 2010-05-06 1377 port->cons.ws.ws_row = port->cons.ws.ws_col = 0; 4b0a2c5ff72152 Pankaj Gupta 2019-03-19 1378 port->cons.vtermno = 0; 9778829cffd4d8 Amit Shah 2010-05-06 1379 c446f8fcc9fba3 Amit Shah 2010-05-19 1380 port->host_connected = port->guest_connected = false; 17e5b4f20adbe2 Amit Shah 2011-09-14 1381 port->stats = (struct port_stats) { 0 }; c446f8fcc9fba3 Amit Shah 2010-05-19 1382 cdfadfc1adb87f Amit Shah 2010-05-19 1383 port->outvq_full = false; cdfadfc1adb87f Amit Shah 2010-05-19 1384 c446f8fcc9fba3 Amit Shah 2010-05-19 1385 port->in_vq = portdev->in_vqs[port->id]; c446f8fcc9fba3 Amit Shah 2010-05-19 1386 port->out_vq = portdev->out_vqs[port->id]; c446f8fcc9fba3 Amit Shah 2010-05-19 1387 d22a69892bd8f2 Amit Shah 2010-09-02 1388 port->cdev = cdev_alloc(); d22a69892bd8f2 Amit Shah 2010-09-02 1389 if (!port->cdev) { d22a69892bd8f2 Amit Shah 2010-09-02 1390 dev_err(&port->portdev->vdev->dev, "Error allocating cdev\n"); d22a69892bd8f2 Amit Shah 2010-09-02 1391 err = -ENOMEM; d22a69892bd8f2 Amit Shah 2010-09-02 1392 goto free_port; d22a69892bd8f2 Amit Shah 2010-09-02 1393 } d22a69892bd8f2 Amit Shah 2010-09-02 1394 port->cdev->ops = &port_fops; c446f8fcc9fba3 Amit Shah 2010-05-19 1395 c446f8fcc9fba3 Amit Shah 2010-05-19 1396 devt = MKDEV(portdev->chr_major, id); d22a69892bd8f2 Amit Shah 2010-09-02 1397 err = cdev_add(port->cdev, devt, 1); c446f8fcc9fba3 Amit Shah 2010-05-19 1398 if (err < 0) { c446f8fcc9fba3 Amit Shah 2010-05-19 1399 dev_err(&port->portdev->vdev->dev, c446f8fcc9fba3 Amit Shah 2010-05-19 1400 "Error %d adding cdev for port %u\n", err, id); d22a69892bd8f2 Amit Shah 2010-09-02 1401 goto free_cdev; c446f8fcc9fba3 Amit Shah 2010-05-19 1402 } 11680fdf29cec5 Ivan Orlov 2023-06-20 1403 port->dev = device_create(&port_class, &port->portdev->vdev->dev, c446f8fcc9fba3 Amit Shah 2010-05-19 1404 devt, port, "vport%up%u", dc18f0800f5f16 Sjur Brændeland 2013-02-12 1405 port->portdev->vdev->index, id); c446f8fcc9fba3 Amit Shah 2010-05-19 1406 if (IS_ERR(port->dev)) { c446f8fcc9fba3 Amit Shah 2010-05-19 1407 err = PTR_ERR(port->dev); c446f8fcc9fba3 Amit Shah 2010-05-19 1408 dev_err(&port->portdev->vdev->dev, c446f8fcc9fba3 Amit Shah 2010-05-19 1409 "Error %d creating device for port %u\n", c446f8fcc9fba3 Amit Shah 2010-05-19 1410 err, id); c446f8fcc9fba3 Amit Shah 2010-05-19 1411 goto free_cdev; c446f8fcc9fba3 Amit Shah 2010-05-19 1412 } c446f8fcc9fba3 Amit Shah 2010-05-19 1413 c446f8fcc9fba3 Amit Shah 2010-05-19 1414 spin_lock_init(&port->inbuf_lock); cdfadfc1adb87f Amit Shah 2010-05-19 1415 spin_lock_init(&port->outvq_lock); c446f8fcc9fba3 Amit Shah 2010-05-19 1416 init_waitqueue_head(&port->waitqueue); c446f8fcc9fba3 Amit Shah 2010-05-19 1417 d791cfcbf98191 Laurent Vivier 2019-11-14 1418 /* We can safely ignore ENOSPC because it means d791cfcbf98191 Laurent Vivier 2019-11-14 1419 * the queue already has buffers. Buffers are removed d791cfcbf98191 Laurent Vivier 2019-11-14 1420 * only by virtcons_remove(), not by unplug_port() d791cfcbf98191 Laurent Vivier 2019-11-14 1421 */ d791cfcbf98191 Laurent Vivier 2019-11-14 1422 err = fill_queue(port->in_vq, &port->inbuf_lock); d791cfcbf98191 Laurent Vivier 2019-11-14 1423 if (err < 0 && err != -ENOSPC) { c446f8fcc9fba3 Amit Shah 2010-05-19 1424 dev_err(port->dev, "Error allocating inbufs\n"); c446f8fcc9fba3 Amit Shah 2010-05-19 1425 goto free_device; c446f8fcc9fba3 Amit Shah 2010-05-19 1426 } c446f8fcc9fba3 Amit Shah 2010-05-19 1427 1b6370463e88b0 Sjur Brændeland 2012-12-14 1428 if (is_rproc_serial(port->portdev->vdev)) c446f8fcc9fba3 Amit Shah 2010-05-19 1429 /* 1b6370463e88b0 Sjur Brændeland 2012-12-14 1430 * For rproc_serial assume remote processor is connected. 1b6370463e88b0 Sjur Brændeland 2012-12-14 1431 * rproc_serial does not want the console port, only 1b6370463e88b0 Sjur Brændeland 2012-12-14 1432 * the generic port implementation. 1b6370463e88b0 Sjur Brændeland 2012-12-14 1433 */ aabd6a8fa5a933 Sjur Brændeland 2013-03-18 1434 port->host_connected = true; 1b6370463e88b0 Sjur Brændeland 2012-12-14 1435 else if (!use_multiport(port->portdev)) { c446f8fcc9fba3 Amit Shah 2010-05-19 1436 /* 1b6370463e88b0 Sjur Brændeland 2012-12-14 1437 * If we're not using multiport support, 1b6370463e88b0 Sjur Brændeland 2012-12-14 1438 * this has to be a console port. c446f8fcc9fba3 Amit Shah 2010-05-19 1439 */ c446f8fcc9fba3 Amit Shah 2010-05-19 1440 err = init_port_console(port); c446f8fcc9fba3 Amit Shah 2010-05-19 1441 if (err) c446f8fcc9fba3 Amit Shah 2010-05-19 1442 goto free_inbufs; c446f8fcc9fba3 Amit Shah 2010-05-19 1443 } c446f8fcc9fba3 Amit Shah 2010-05-19 1444 c446f8fcc9fba3 Amit Shah 2010-05-19 1445 spin_lock_irq(&portdev->ports_lock); c446f8fcc9fba3 Amit Shah 2010-05-19 1446 list_add_tail(&port->list, &port->portdev->ports); c446f8fcc9fba3 Amit Shah 2010-05-19 1447 spin_unlock_irq(&portdev->ports_lock); c446f8fcc9fba3 Amit Shah 2010-05-19 1448 c446f8fcc9fba3 Amit Shah 2010-05-19 1449 /* c446f8fcc9fba3 Amit Shah 2010-05-19 1450 * Tell the Host we're set so that it can send us various c446f8fcc9fba3 Amit Shah 2010-05-19 1451 * configuration parameters for this port (eg, port name, c446f8fcc9fba3 Amit Shah 2010-05-19 1452 * caching, whether this is a console port, etc.) c446f8fcc9fba3 Amit Shah 2010-05-19 1453 */ c446f8fcc9fba3 Amit Shah 2010-05-19 1454 send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1); c446f8fcc9fba3 Amit Shah 2010-05-19 1455 c446f8fcc9fba3 Amit Shah 2010-05-19 1456 /* c446f8fcc9fba3 Amit Shah 2010-05-19 1457 * Finally, create the debugfs file that we can use to c446f8fcc9fba3 Amit Shah 2010-05-19 1458 * inspect a port's state at any time c446f8fcc9fba3 Amit Shah 2010-05-19 1459 */ db1700685c0ad2 Dan Carpenter 2015-05-08 @1460 snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u", dc18f0800f5f16 Sjur Brændeland 2013-02-12 1461 port->portdev->vdev->index, id); c446f8fcc9fba3 Amit Shah 2010-05-19 1462 port->debugfs_file = debugfs_create_file(debugfs_name, 0444, c446f8fcc9fba3 Amit Shah 2010-05-19 1463 pdrvdata.debugfs_dir, fb11de92ac6e4a Greg Kroah-Hartman 2021-02-16 1464 port, &port_debugfs_fops); c446f8fcc9fba3 Amit Shah 2010-05-19 1465 return 0; c446f8fcc9fba3 Amit Shah 2010-05-19 1466 c446f8fcc9fba3 Amit Shah 2010-05-19 1467 free_inbufs: c446f8fcc9fba3 Amit Shah 2010-05-19 1468 free_device: 11680fdf29cec5 Ivan Orlov 2023-06-20 1469 device_destroy(&port_class, port->dev->devt); c446f8fcc9fba3 Amit Shah 2010-05-19 1470 free_cdev: d22a69892bd8f2 Amit Shah 2010-09-02 1471 cdev_del(port->cdev); c446f8fcc9fba3 Amit Shah 2010-05-19 1472 free_port: c446f8fcc9fba3 Amit Shah 2010-05-19 1473 kfree(port); c446f8fcc9fba3 Amit Shah 2010-05-19 1474 fail: c446f8fcc9fba3 Amit Shah 2010-05-19 1475 /* The host might want to notify management sw about port add failure */ 0643e4c6e4fd67 Julia Lawall 2010-05-15 1476 __send_control_msg(portdev, id, VIRTIO_CONSOLE_PORT_READY, 0); c446f8fcc9fba3 Amit Shah 2010-05-19 1477 return err; c446f8fcc9fba3 Amit Shah 2010-05-19 1478 } c446f8fcc9fba3 Amit Shah 2010-05-19 1479
:::::: The code at line 1460 was first introduced by commit :::::: db1700685c0ad2ecb9e42af6a568435a03bbc3fd virtio_console: silence a static checker warning
:::::: TO: Dan Carpenter dan.carpenter@oracle.com :::::: CC: Greg Kroah-Hartman gregkh@linuxfoundation.org