All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>, ofono@lists.linux.dev
Cc: absicsz@gmail.com, merlijn@wizzup.org
Subject: Re: [PATCH 2/2] qmimodem: implement call-forwarding driver
Date: Thu, 15 Feb 2024 14:46:17 -0600	[thread overview]
Message-ID: <7dc5103a-ec8b-47c7-9ddf-2be524701d20@gmail.com> (raw)
In-Reply-To: <1707981467-2955-3-git-send-email-ivo.g.dimitrov.75@gmail.com>

Hi Ivaylo,

On 2/15/24 01:17, Ivaylo Dimitrov wrote:
> ---
>   Makefile.am                        |   3 +-
>   drivers/qmimodem/call-forwarding.c | 352 +++++++++++++++++++++++++++++++++++++
>   drivers/qmimodem/voice.h           |   1 +

I fixed up a small whitespace warning flagged by CI:
0002-qmimodem-implement-call-forwarding-driver.patch:394: WARNING: please, no 
space before tabs

>   plugins/gobi.c                     |   3 +
>   4 files changed, 358 insertions(+), 1 deletion(-)
>   create mode 100644 drivers/qmimodem/call-forwarding.c
> 

<snip>

> +
> +struct call_forwarding_info_ext {
> +	uint8_t active;
> +	uint8_t cls;
> +	uint8_t time;
> +	uint8_t pind;
> +	uint8_t sind;
> +	uint8_t type;
> +	uint8_t plan;
> +	uint8_t len;
> +	uint8_t number[0];

Also, changed this to number[] due to:

0002-qmimodem-implement-call-forwarding-driver.patch:80: ERROR: Use C99 flexible 
arrays - see 
https://docs.kernel.org/process/deprecated.html#zero-length-and-one-element-arrays

> +};
> +

<snip>

> +static void query_cb(struct qmi_result *result, void *user_data)
> +{
> +	struct cb_data *cbd = user_data;
> +	ofono_call_forwarding_query_cb_t cb = cbd->cb;
> +	const uint8_t *p;
> +	uint8_t num;
> +	uint16_t length;
> +
> +	DBG("");
> +
> +	if (qmi_result_set_error(result, NULL))
> +		goto error;
> +
> +	/*
> +	 * we want extended info, because of the number type.
> +	 * FIXME - shall we fallback to 0x10 if there is no extended info?
> +	 */
> +	p = qmi_result_get(result, 0x16, &length);
> +	if (p) {
> +		struct ofono_call_forwarding_condition *list;
> +		const uint8_t *end = p + length;
> +		int i;
> +
> +		num = *p++;

Can length be 0?  If so, feel free to send a fix :)

> +
> +		list = g_new0(struct ofono_call_forwarding_condition, num);
> +
> +		for (i = 0; i < num; i++) {
> +			struct call_forwarding_info_ext *info = (void *)p;
> +			int type;
> +
> +			/* do not try to access beyond buffer end */
> +			if (p + sizeof(*info) > end ||
> +					p + sizeof(*info) + info->len > end) {
> +				g_free(list);
> +				goto error;
> +			}
> +
> +			if (info->type == 1)
> +				type = OFONO_NUMBER_TYPE_INTERNATIONAL;
> +			else
> +				type = OFONO_NUMBER_TYPE_UNKNOWN;
> +
> +			set_fwd_cond(&list[i], info->active, info->cls,
> +					info->time, type, info->number,
> +					info->len);
> +			p += sizeof(*info) + info->len;
> +		}
> +
> +		CALLBACK_WITH_SUCCESS(cb, num, list, cbd->data);
> +		g_free(list);
> +		return;
> +	}
> +
> +error:
> +	CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data);
> +}
> +

Applied, thanks.

Regards,
-Denis


  reply	other threads:[~2024-02-15 20:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15  7:17 [0/2] qmimodem: add more drivers Ivaylo Dimitrov
2024-02-15  7:17 ` [PATCH 1/2] qmimodem: implement call-barring driver Ivaylo Dimitrov
2024-02-15 20:43   ` Denis Kenzior
2024-02-15  7:17 ` [PATCH 2/2] qmimodem: implement call-forwarding driver Ivaylo Dimitrov
2024-02-15 20:46   ` Denis Kenzior [this message]
2024-02-16 17:07     ` Ivaylo Dimitrov
2024-02-16 17:13       ` Denis Kenzior
2024-02-16 17:56         ` Ivaylo Dimitrov

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=7dc5103a-ec8b-47c7-9ddf-2be524701d20@gmail.com \
    --to=denkenz@gmail.com \
    --cc=absicsz@gmail.com \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=merlijn@wizzup.org \
    --cc=ofono@lists.linux.dev \
    /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 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.