From: Johan Hedberg <johan.hedberg@nokia.com>
To: ext-tommi.keisala@nokia.comt
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Fix crash when GetProperties req is received before any adapters are set up
Date: Fri, 22 Oct 2010 11:12:07 -0200 [thread overview]
Message-ID: <20101022131207.GA29655@jh-x301> (raw)
In-Reply-To: <1287743558-17002-2-git-send-email-ext-tommi.keisala@nokia.com>
Hi Tommi,
On Fri, Oct 22, 2010, ext-tommi.keisala@nokia.com wrote:
> This patch avoids a crash when org.bluez.Manager GetProperties request is
> received and there is not yet any adapters ready. Happens often for example
> when bluetoothd and ofonod is started next ot each other.
>
> Signed-off-by: Tommi Keisala <ext-tommi.keisala@nokia.com>
> ---
> src/manager.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
Looks like a bugfix is definitely in order here, but why introduce a new
variable to the function? Wouldn't something like the folling be good
enough:
--- a/src/manager.c
+++ b/src/manager.c
@@ -197,13 +197,14 @@ static DBusMessage *get_properties(DBusConnection *conn,
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
array = g_new0(char *, g_slist_length(adapters) + 1);
- for (i = 0, list = adapters; list; list = list->next, i++) {
+ for (i = 0, list = adapters; list; list = list->next) {
struct btd_adapter *adapter = list->data;
if (!adapter_is_ready(adapter))
continue;
array[i] = (char *) adapter_get_path(adapter);
+ i++;
}
dict_append_array(&dict, "Adapters", DBUS_TYPE_OBJECT_PATH, &array, i);
g_free(array);
Could you send a new patch which doesn't introduce a new variable? Also,
please leave out the signed-off-by from the commit message since it's
not used for userspace bluez patches. Thanks.
Johan
next prev parent reply other threads:[~2010-10-22 13:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-22 10:32 [PATCH] Fix crash when GetProperties req is received before any adapters are set up ext-tommi.keisala
2010-10-22 10:32 ` ext-tommi.keisala
2010-10-22 13:12 ` Johan Hedberg [this message]
2010-10-22 20:25 ` Luiz Augusto von Dentz
2010-10-22 20:40 ` Johan Hedberg
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=20101022131207.GA29655@jh-x301 \
--to=johan.hedberg@nokia.com \
--cc=ext-tommi.keisala@nokia.comt \
--cc=linux-bluetooth@vger.kernel.org \
/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).