[PATCH] usb: typec: intel_pmc_mux: Silence snprintf() output truncation warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the function pmc_mux_port_debugfs_init() the buffer for
the name of the port is limited to six bytes. That makes the
compiler think that the output of "port%d" may be truncated.
That can't actually happen as the interface can support
maximum of eight ports. To make the compiler happy just
increase the buffer to where the warning goes away.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202412031437.vX580pxx-lkp@xxxxxxxxx/
Cc: Rajat Khandelwal <rajat.khandelwal@xxxxxxxxxxxxxxx>
Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 5dfe95754394..65dda9183e6f 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -718,7 +718,7 @@ DEFINE_SHOW_ATTRIBUTE(port_iom_status);
 static void pmc_mux_port_debugfs_init(struct pmc_usb_port *port)
 {
 	struct dentry *debugfs_dir;
-	char name[6];
+	char name[8];
 
 	snprintf(name, sizeof(name), "port%d", port->usb3_port - 1);
 
-- 
2.45.2





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux