Hi,
On Fri, Oct 26, 2018 at 12:45 PM Jonas Bonn <jonas(a)southpole.se> wrote:
On 26/10/2018 12:32, Giacinto Cifelli wrote:
> hi Jonas,
>
> On Fri, 26 Oct 2018, 12:13 Jonas Bonn, <jonas(a)norrbonn.se
> <mailto:jonas@norrbonn.se>> wrote:
>
> From: Jonas Bonn <jonas(a)southpole.se <mailto:jonas@southpole.se>>
>
> Move initialization of 'dcs' ahead of 'content' fetch to
prevent
> uninitialized use.
> ---
> drivers/huaweimodem/ussd.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/huaweimodem/ussd.c b/drivers/huaweimodem/ussd.c
> index fbed3cd0..f4001108 100644
> --- a/drivers/huaweimodem/ussd.c
> +++ b/drivers/huaweimodem/ussd.c
> @@ -62,12 +62,12 @@ static void cusd_parse(GAtResult *result, struct
> ofono_ussd *ussd)
> if (!g_at_result_iter_next_number(&iter, &status))
> return;
>
> - if (!g_at_result_iter_next_string(&iter, &content))
> - goto out;
> -
> if (!g_at_result_iter_next_number(&iter, &dcs))
> dcs = 0;
>
> + if (!g_at_result_iter_next_string(&iter, &content))
> + goto out;
> +
>
>
> aren't you changing the order of the parameters in the command response?
Ah, of course. Good catch.
Disregard this patch... it's not the right fix.
> Have you tested this on an actual modem?
Don't have one of these. This patch was addressing a compiler warning,
but the fix is obviously wrong.
here and in patch 8/9 the it looks like you can get rid of the warning
by initializing the variable:
int dcs = 0;
Thanks,
Jonas
>
> msg_ptr = decode_hex_own_buf(content, -1, &msg_len, 0, msg);
>
> regards,
> Giacinto
>
Regards,
Giacinto