All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix not checking for valid hdev on bt_dev_{info,warn,err,dbg}
@ 2022-03-02 23:08 Luiz Augusto von Dentz
  2022-03-03  2:38 ` bluez.test.bot
  2022-03-03 12:25 ` [PATCH] " Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-03-02 23:08 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This fixes attemting to print hdev->name directly which causes them to
print an error:

kernel: read_version:367: (efault): sock 000000006a3008f2

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 include/net/bluetooth/bluetooth.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index a647e5fabdbd..d82736e58d45 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -204,19 +204,21 @@ void bt_err_ratelimited(const char *fmt, ...);
 #define BT_DBG(fmt, ...)	pr_debug(fmt "\n", ##__VA_ARGS__)
 #endif
 
+#define bt_dev_name(hdev) (hdev ? (hdev)->name : NULL)
+
 #define bt_dev_info(hdev, fmt, ...)				\
-	BT_INFO("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
+	BT_INFO("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
 #define bt_dev_warn(hdev, fmt, ...)				\
-	BT_WARN("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
+	BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
 #define bt_dev_err(hdev, fmt, ...)				\
-	BT_ERR("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
+	BT_ERR("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
 #define bt_dev_dbg(hdev, fmt, ...)				\
-	BT_DBG("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
+	BT_DBG("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
 
 #define bt_dev_warn_ratelimited(hdev, fmt, ...)			\
-	bt_warn_ratelimited("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
+	bt_warn_ratelimited("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
 #define bt_dev_err_ratelimited(hdev, fmt, ...)			\
-	bt_err_ratelimited("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
+	bt_err_ratelimited("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
 
 /* Connection and socket states */
 enum {
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: Fix not checking for valid hdev on bt_dev_{info,warn,err,dbg}
  2022-03-02 23:08 [PATCH] Bluetooth: Fix not checking for valid hdev on bt_dev_{info,warn,err,dbg} Luiz Augusto von Dentz
@ 2022-03-03  2:38 ` bluez.test.bot
  2022-03-03 12:25 ` [PATCH] " Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-03-03  2:38 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=619731

---Test result---

Test Summary:
CheckPatch                    PASS      1.17 seconds
GitLint                       PASS      0.70 seconds
SubjectPrefix                 PASS      0.66 seconds
BuildKernel                   PASS      34.09 seconds
BuildKernel32                 PASS      29.89 seconds
Incremental Build with patchesPASS      39.38 seconds
TestRunner: Setup             PASS      581.60 seconds
TestRunner: l2cap-tester      PASS      11.15 seconds
TestRunner: bnep-tester       PASS      4.70 seconds
TestRunner: mgmt-tester       PASS      91.13 seconds
TestRunner: rfcomm-tester     FAIL      5.91 seconds
TestRunner: sco-tester        PASS      5.97 seconds
TestRunner: smp-tester        PASS      5.89 seconds
TestRunner: userchan-tester   PASS      4.85 seconds

Details
##############################
Test: TestRunner: rfcomm-tester - FAIL - 5.91 seconds
Run test-runner with rfcomm-tester
Total: 10, Passed: 9 (90.0%), Failed: 1, Not Run: 0

Failed Test Cases
Basic RFCOMM Socket Client - Write 32k Success       Failed       0.125 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: Fix not checking for valid hdev on bt_dev_{info,warn,err,dbg}
  2022-03-02 23:08 [PATCH] Bluetooth: Fix not checking for valid hdev on bt_dev_{info,warn,err,dbg} Luiz Augusto von Dentz
  2022-03-03  2:38 ` bluez.test.bot
@ 2022-03-03 12:25 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2022-03-03 12:25 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

> This fixes attemting to print hdev->name directly which causes them to
> print an error:
> 
> kernel: read_version:367: (efault): sock 000000006a3008f2
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
> include/net/bluetooth/bluetooth.h | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> index a647e5fabdbd..d82736e58d45 100644
> --- a/include/net/bluetooth/bluetooth.h
> +++ b/include/net/bluetooth/bluetooth.h
> @@ -204,19 +204,21 @@ void bt_err_ratelimited(const char *fmt, ...);
> #define BT_DBG(fmt, ...)	pr_debug(fmt "\n", ##__VA_ARGS__)
> #endif
> 
> +#define bt_dev_name(hdev) (hdev ? (hdev)->name : NULL)
> +

use ((hdev) ? (hdev)->name : “null”)

> #define bt_dev_info(hdev, fmt, ...)				\
> -	BT_INFO("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
> +	BT_INFO("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
> #define bt_dev_warn(hdev, fmt, ...)				\
> -	BT_WARN("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
> +	BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
> #define bt_dev_err(hdev, fmt, ...)				\
> -	BT_ERR("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
> +	BT_ERR("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
> #define bt_dev_dbg(hdev, fmt, ...)				\
> -	BT_DBG("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
> +	BT_DBG("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
> 
> #define bt_dev_warn_ratelimited(hdev, fmt, ...)			\
> -	bt_warn_ratelimited("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
> +	bt_warn_ratelimited("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
> #define bt_dev_err_ratelimited(hdev, fmt, ...)			\
> -	bt_err_ratelimited("%s: " fmt, (hdev)->name, ##__VA_ARGS__)
> +	bt_err_ratelimited("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-03 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 23:08 [PATCH] Bluetooth: Fix not checking for valid hdev on bt_dev_{info,warn,err,dbg} Luiz Augusto von Dentz
2022-03-03  2:38 ` bluez.test.bot
2022-03-03 12:25 ` [PATCH] " Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.