All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] isotest: Fix not handling 0 length packets
@ 2024-01-23 15:28 Luiz Augusto von Dentz
  2024-01-23 16:32 ` [BlueZ,v1] " bluez.test.bot
  2024-01-23 18:41 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-01-23 15:28 UTC (permalink / raw)
  To: linux-bluetooth

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

It is in fact possible to receive 0 length packets since that probably
means their status is not sucess.
---
 tools/isotest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/isotest.c b/tools/isotest.c
index 771d24b6d2a6..7e875fa58b15 100644
--- a/tools/isotest.c
+++ b/tools/isotest.c
@@ -642,7 +642,7 @@ static void dump_mode(int fd, int sk, char *peer)
 	}
 
 	syslog(LOG_INFO, "Receiving ...");
-	while ((len = read(sk, buf, data_size)) > 0) {
+	while ((len = read(sk, buf, data_size)) >= 0) {
 		if (fd >= 0) {
 			len = write(fd, buf, len);
 			if (len < 0) {
@@ -680,7 +680,7 @@ static void recv_mode(int fd, int sk, char *peer)
 			int r;
 
 			r = recv(sk, buf, data_size, 0);
-			if (r <= 0) {
+			if (r < 0) {
 				if (r < 0)
 					syslog(LOG_ERR, "Read failed: %s (%d)",
 							strerror(errno), errno);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH BlueZ v1] isotest: Fix not handling 0 length packets
@ 2024-01-23 15:28 Luiz Augusto von Dentz
  2024-01-23 16:32 ` [BlueZ,v1] " bluez.test.bot
  0 siblings, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-01-23 15:28 UTC (permalink / raw)
  To: linux-bluetooth

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

It is in fact possible to receive 0 length packets since that probably
means their status is not sucess.
---
 tools/isotest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/isotest.c b/tools/isotest.c
index 771d24b6d2a6..7e875fa58b15 100644
--- a/tools/isotest.c
+++ b/tools/isotest.c
@@ -642,7 +642,7 @@ static void dump_mode(int fd, int sk, char *peer)
 	}
 
 	syslog(LOG_INFO, "Receiving ...");
-	while ((len = read(sk, buf, data_size)) > 0) {
+	while ((len = read(sk, buf, data_size)) >= 0) {
 		if (fd >= 0) {
 			len = write(fd, buf, len);
 			if (len < 0) {
@@ -680,7 +680,7 @@ static void recv_mode(int fd, int sk, char *peer)
 			int r;
 
 			r = recv(sk, buf, data_size, 0);
-			if (r <= 0) {
+			if (r < 0) {
 				if (r < 0)
 					syslog(LOG_ERR, "Read failed: %s (%d)",
 							strerror(errno), errno);
-- 
2.43.0


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

end of thread, other threads:[~2024-01-23 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 15:28 [PATCH BlueZ v1] isotest: Fix not handling 0 length packets Luiz Augusto von Dentz
2024-01-23 16:32 ` [BlueZ,v1] " bluez.test.bot
2024-01-23 18:41 ` [PATCH BlueZ v1] " patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2024-01-23 15:28 Luiz Augusto von Dentz
2024-01-23 16:32 ` [BlueZ,v1] " bluez.test.bot

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.