]> www.infradead.org Git - users/hch/misc.git/commitdiff
usb: typec: intel_pmc_mux: Silence snprintf() output truncation warning
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Thu, 5 Dec 2024 11:39:19 +0000 (13:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Dec 2024 17:40:19 +0000 (18:40 +0100)
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@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202412031437.vX580pxx-lkp@intel.com/
Cc: Rajat Khandelwal <rajat.khandelwal@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20241205113919.1182673-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/mux/intel_pmc_mux.c

index 5dfe95754394611b46b798f577d56cb1afcde003..65dda9183e6fb61b6d726aa0ea739e48a15b0dca 100644 (file)
@@ -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);