Patch "Bluetooth: hci_core: Fix build warnings" has been added to the 4.14-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    Bluetooth: hci_core: Fix build warnings

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bluetooth-hci_core-fix-build-warnings.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4c3f88ef77b822b0e67f35bf2c72a54d3e4652a1
Author: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
Date:   Fri Sep 15 14:42:27 2023 -0700

    Bluetooth: hci_core: Fix build warnings
    
    [ Upstream commit dcda165706b9fbfd685898d46a6749d7d397e0c0 ]
    
    This fixes the following warnings:
    
    net/bluetooth/hci_core.c: In function ‘hci_register_dev’:
    net/bluetooth/hci_core.c:2620:54: warning: ‘%d’ directive output may
    be truncated writing between 1 and 10 bytes into a region of size 5
    [-Wformat-truncation=]
     2620 |         snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
          |                                                      ^~
    net/bluetooth/hci_core.c:2620:50: note: directive argument in the range
    [0, 2147483647]
     2620 |         snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
          |                                                  ^~~~~~~
    net/bluetooth/hci_core.c:2620:9: note: ‘snprintf’ output between 5 and
    14 bytes into a destination of size 8
     2620 |         snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d42288a06af61..8f899ad4a7546 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -205,7 +205,7 @@ struct hci_dev {
 	struct list_head list;
 	struct mutex	lock;
 
-	char		name[8];
+	const char	*name;
 	unsigned long	flags;
 	__u16		id;
 	__u8		bus;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 7052434c1061f..2bf0bdee7186d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3113,7 +3113,11 @@ int hci_register_dev(struct hci_dev *hdev)
 	if (id < 0)
 		return id;
 
-	snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
+	error = dev_set_name(&hdev->dev, "hci%u", id);
+	if (error)
+		return error;
+
+	hdev->name = dev_name(&hdev->dev);
 	hdev->id = id;
 
 	BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
@@ -3135,8 +3139,6 @@ int hci_register_dev(struct hci_dev *hdev)
 	if (!IS_ERR_OR_NULL(bt_debugfs))
 		hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs);
 
-	dev_set_name(&hdev->dev, "%s", hdev->name);
-
 	error = device_add(&hdev->dev);
 	if (error < 0)
 		goto err_wqueue;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux