linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tedd Ho-Jeong An <hj.tedd.an@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: tedd.an@intel.com
Subject: [PATCH 5/6] profile/bnep: Fix the unchecked return value
Date: Fri, 20 Nov 2020 12:07:11 -0800	[thread overview]
Message-ID: <20201120200712.491219-5-tedd.an@intel.com> (raw)
In-Reply-To: <20201120200712.491219-1-tedd.an@intel.com>

This patch fixes the unchecked return value.
---
 profiles/network/bnep.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 4dde55786..7e777e29c 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -255,7 +255,11 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond,
 
 	memset(&timeo, 0, sizeof(timeo));
 	timeo.tv_sec = 0;
-	setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
+	if (setsockopt(sk, SOL_SOCKET, SO_RCVTIMEO, &timeo,
+							sizeof(timeo)) < 0) {
+		error("bnep: Set setsockopt failed: %s", strerror(errno));
+		goto failed;
+	};
 
 	sk = g_io_channel_unix_get_fd(session->io);
 	if (bnep_connadd(sk, session->src, session->iface) < 0)
-- 
2.25.4


  parent reply	other threads:[~2020-11-20 20:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 20:07 [PATCH 1/6] monitor: Fix potential memory leak Tedd Ho-Jeong An
2020-11-20 20:07 ` [PATCH 2/6] monitor: Fix the unchecked return value Tedd Ho-Jeong An
2020-11-20 20:07 ` [PATCH 3/6] btio: " Tedd Ho-Jeong An
2020-11-20 20:07 ` [PATCH 4/6] emulator: " Tedd Ho-Jeong An
2020-11-20 20:07 ` Tedd Ho-Jeong An [this message]
2020-11-20 20:07 ` [PATCH 6/6] lib: " Tedd Ho-Jeong An
2020-11-20 20:27 ` [1/6] monitor: Fix potential memory leak bluez.test.bot
2020-11-24 21:22   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201120200712.491219-5-tedd.an@intel.com \
    --to=hj.tedd.an@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=tedd.an@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).