diff mbox series

[BlueZ] monitor: Fix runtime error

Message ID 20230831210554.1141646-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ] monitor: Fix runtime error | expand

Commit Message

Luiz Augusto von Dentz Aug. 31, 2023, 9:05 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This fixes the following runtime error:

monitor/packet.c:10476:2: runtime error: division by zero
Floating point exception
---
 monitor/packet.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

bluez.test.bot@gmail.com Aug. 31, 2023, 10:22 p.m. UTC | #1
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=780953

---Test result---

Test Summary:
CheckPatch                    PASS      0.48 seconds
GitLint                       PASS      0.32 seconds
BuildEll                      PASS      33.86 seconds
BluezMake                     PASS      1025.75 seconds
MakeCheck                     PASS      13.10 seconds
MakeDistcheck                 PASS      190.23 seconds
CheckValgrind                 PASS      309.83 seconds
CheckSmatch                   WARNING   407.76 seconds
bluezmakeextell               PASS      124.64 seconds
IncrementalBuild              PASS      817.95 seconds
ScanBuild                     PASS      1254.40 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1856:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3606:52: warning: array of flexible structuresmonitor/bt.h:3594:40: warning: array of flexible structures


---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Sept. 1, 2023, 4:54 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 31 Aug 2023 14:05:54 -0700 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This fixes the following runtime error:
> 
> monitor/packet.c:10476:2: runtime error: division by zero
> Floating point exception
> 
> [...]

Here is the summary with links:
  - [BlueZ] monitor: Fix runtime error
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=c7fd9310b925

You are awesome, thank you!
diff mbox series

Patch

diff --git a/monitor/packet.c b/monitor/packet.c
index 8eae8c9ea8fa..279f5408df42 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -10473,11 +10473,14 @@  static void packet_dequeue_tx(struct timeval *tv, uint16_t handle)
 
 	packet_latency_add(&conn->tx_l, &delta);
 
-	print_field("#%zu: len %zu (%lld Kb/s)", frame->num, frame->len,
-					frame->len * 8 / TV_MSEC(delta));
-	print_field("Latency: %lld msec (%lld-%lld msec ~%lld msec)",
-			TV_MSEC(delta), TV_MSEC(conn->tx_l.min),
-			TV_MSEC(conn->tx_l.max), TV_MSEC(conn->tx_l.med));
+	if (TV_MSEC(delta)) {
+		print_field("#%zu: len %zu (%lld Kb/s)", frame->num, frame->len,
+				frame->len * 8 / TV_MSEC(delta));
+		print_field("Latency: %lld msec (%lld-%lld msec ~%lld msec)",
+				TV_MSEC(delta), TV_MSEC(conn->tx_l.min),
+				TV_MSEC(conn->tx_l.max),
+				TV_MSEC(conn->tx_l.med));
+	}
 
 	l2cap_dequeue_frame(&delta, conn);