summaryrefslogtreecommitdiff
path: root/drivers/char/virtio_console.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-05-08 12:16:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-24 12:24:35 -0700
commitdb1700685c0ad2ecb9e42af6a568435a03bbc3fd (patch)
treebf16643054df737ac964abdf20d0e251226422c9 /drivers/char/virtio_console.c
parent45c554ece9cffbdf67299b87ba785529276cd2dd (diff)
downloadlwn-db1700685c0ad2ecb9e42af6a568435a03bbc3fd.tar.gz
lwn-db1700685c0ad2ecb9e42af6a568435a03bbc3fd.zip
virtio_console: silence a static checker warning
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>
Diffstat (limited to 'drivers/char/virtio_console.c')
-rw-r--r--drivers/char/virtio_console.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 50754d203310..d2406fe25533 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -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,