virtio_console: silence a static checker warning
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 May 2015 09:16:25 +0000 (12:16 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 May 2015 19:24:35 +0000 (12:24 -0700)
My static checker complains that this sprintf() can overflow but really
it can't.  Just silence the warning by using snprintf().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/virtio_console.c

index 50754d2033100851b87f78d06401a3c5c137262d..d2406fe2553396a807a169ddd93b656a4876a537 100644 (file)
@@ -1492,8 +1492,8 @@ static int add_port(struct ports_device *portdev, u32 id)
                 * Finally, create the debugfs file that we can use to
                 * inspect a port's state at any time
                 */
-               sprintf(debugfs_name, "vport%up%u",
-                       port->portdev->vdev->index, id);
+               snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u",
+                        port->portdev->vdev->index, id);
                port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
                                                         pdrvdata.debugfs_dir,
                                                         port,