* Re: [PATCH] Check modem_obj_path is not NULL
2010-03-29 20:32 [PATCH] Check modem_obj_path is not NULL Forrest Zhao
@ 2010-03-29 7:39 ` Johan Hedberg
2010-03-29 7:58 ` Zhao Forrest
0 siblings, 1 reply; 3+ messages in thread
From: Johan Hedberg @ 2010-03-29 7:39 UTC (permalink / raw)
To: Forrest Zhao; +Cc: linux-bluetooth, forrest.zhao
Hi Forrest,
On Mon, Mar 29, 2010, Forrest Zhao wrote:
> This could prevent crash in case modem_obj_path is NULL.
> ---
> audio/telephony-ofono.c | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
> index 45c3905..c145e87 100644
> --- a/audio/telephony-ofono.c
> +++ b/audio/telephony-ofono.c
> @@ -281,6 +281,10 @@ void telephony_dial_number_req(void *telephony_device, const char *number)
>
> debug("telephony-ofono: dial request to %s", number);
>
> + if (!modem_obj_path)
> + telephony_dial_number_rsp(telephony_device,
> + CME_ERROR_AG_FAILURE);
> +
> if (!strncmp(number, "*31#", 4)) {
> number += 4;
> clir = "enabled";
> @@ -311,6 +315,10 @@ void telephony_transmit_dtmf_req(void *telephony_device, char tone)
>
> debug("telephony-ofono: transmit dtmf: %c", tone);
>
> + if (!modem_obj_path)
> + telephony_transmit_dtmf_rsp(telephony_device,
> + CME_ERROR_AG_FAILURE);
> +
> tone_string = g_strdup_printf("%c", tone);
> ret = send_method_call(OFONO_BUS_NAME, modem_obj_path,
This doesn't look right. You report an error but still proceed in the
functions (which will later try to access modem_obj_path). I guess you
should return from the functions in both of these if-clauses.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Check modem_obj_path is not NULL
2010-03-29 7:39 ` Johan Hedberg
@ 2010-03-29 7:58 ` Zhao Forrest
0 siblings, 0 replies; 3+ messages in thread
From: Zhao Forrest @ 2010-03-29 7:58 UTC (permalink / raw)
To: Forrest Zhao, linux-bluetooth, forrest.zhao
>> @@ -311,6 +315,10 @@ void telephony_transmit_dtmf_req(void *telephony_device, char tone)
>>
>> debug("telephony-ofono: transmit dtmf: %c", tone);
>>
>> + if (!modem_obj_path)
>> + telephony_transmit_dtmf_rsp(telephony_device,
>> + CME_ERROR_AG_FAILURE);
>> +
>> tone_string = g_strdup_printf("%c", tone);
>> ret = send_method_call(OFONO_BUS_NAME, modem_obj_path,
>
> This doesn't look right. You report an error but still proceed in the
> functions (which will later try to access modem_obj_path). I guess you
> should return from the functions in both of these if-clauses.
>
My bad. Will send out the updated patch ASAP.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Check modem_obj_path is not NULL
@ 2010-03-29 20:32 Forrest Zhao
2010-03-29 7:39 ` Johan Hedberg
0 siblings, 1 reply; 3+ messages in thread
From: Forrest Zhao @ 2010-03-29 20:32 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth, forrest.zhao, Forrest Zhao
This could prevent crash in case modem_obj_path is NULL.
---
audio/telephony-ofono.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
index 45c3905..c145e87 100644
--- a/audio/telephony-ofono.c
+++ b/audio/telephony-ofono.c
@@ -281,6 +281,10 @@ void telephony_dial_number_req(void *telephony_device, const char *number)
debug("telephony-ofono: dial request to %s", number);
+ if (!modem_obj_path)
+ telephony_dial_number_rsp(telephony_device,
+ CME_ERROR_AG_FAILURE);
+
if (!strncmp(number, "*31#", 4)) {
number += 4;
clir = "enabled";
@@ -311,6 +315,10 @@ void telephony_transmit_dtmf_req(void *telephony_device, char tone)
debug("telephony-ofono: transmit dtmf: %c", tone);
+ if (!modem_obj_path)
+ telephony_transmit_dtmf_rsp(telephony_device,
+ CME_ERROR_AG_FAILURE);
+
tone_string = g_strdup_printf("%c", tone);
ret = send_method_call(OFONO_BUS_NAME, modem_obj_path,
OFONO_VCMANAGER_INTERFACE,
@@ -531,6 +539,9 @@ done:
static int get_registration_and_signal_status()
{
+ if (!modem_obj_path)
+ return -ENOENT;
+
return send_method_call(OFONO_BUS_NAME, modem_obj_path,
OFONO_NETWORKREG_INTERFACE,
"GetProperties", get_registration_reply,
--
1.6.1.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-03-29 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-29 20:32 [PATCH] Check modem_obj_path is not NULL Forrest Zhao
2010-03-29 7:39 ` Johan Hedberg
2010-03-29 7:58 ` Zhao Forrest
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).