From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 2/2] qmimodem: sms: Silence valgrind warning
Date: Tue, 19 Mar 2024 11:42:54 -0500 [thread overview]
Message-ID: <20240319164309.2676887-2-denkenz@gmail.com> (raw)
In-Reply-To: <20240319164309.2676887-1-denkenz@gmail.com>
ofonod[2670789]: drivers/qmimodem/sms.c:get_msg_protocol_cb()
==2670789== Conditional jump or move depends on uninitialised value(s)
==2670789== at 0x46552A: get_msg_protocol_cb (sms.c:565)
==2670789== by 0x45D5C1: service_send_callback (qmi.c:2762)
==2670789== by 0x4594F5: __rx_message (qmi.c:846)
==2670789== by 0x45A6A4: received_qmux_data (qmi.c:1393)
==2670789== by 0x58D71C: io_callback (io.c:105)
==2670789== by 0x58C073: l_main_iterate (main.c:461)
==2670789== by 0x500EC0: event_check (main.c:190)
==2670789== by 0x48FC09D: ??? (in /usr/lib/libglib-2.0.so.0.7800.3)
==2670789== by 0x49591CF: ??? (in /usr/lib/libglib-2.0.so.0.7800.3)
==2670789== by 0x48FBB96: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.7800.3)
==2670789== by 0x5011F5: main (main.c:284)
==2670789==
ofonod[2670789]: drivers/qmimodem/sms.c:get_msg_list()
The warning is triggered because GET_MSG_PROTOCOL command succeeds and
qmi_result_set_error() returns false. It seems the intent in this case
is to use the msg_mode reported by the device by obtaining it using
qmi_result_get_uint8. In case GET_MSG_PROTOCOL command fails, both CDMA
and WCDMA messages should be queried.
---
drivers/qmimodem/sms.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/qmimodem/sms.c b/drivers/qmimodem/sms.c
index 498a6d778303..b9fe963520d6 100644
--- a/drivers/qmimodem/sms.c
+++ b/drivers/qmimodem/sms.c
@@ -556,21 +556,23 @@ static void get_msg_protocol_cb(struct qmi_result *result, void *user_data)
DBG("");
- if (qmi_result_set_error(result, &err) &&
- (err != QMI_ERR_OP_DEVICE_UNSUPPORTED)) {
- DBG("Err: protocol %d - %s", err, qmi_result_get_error(result));
- return;
- }
+ if (qmi_result_set_error(result, &err)) {
+ if (err != QMI_ERR_OP_DEVICE_UNSUPPORTED) {
+ DBG("Err: protocol %d - %s",
+ err, qmi_result_get_error(result));
+ return;
+ }
- if (err != QMI_ERR_OP_DEVICE_UNSUPPORTED) {
- /* modem supports only 1 protocol */
- qmi_result_get_uint8(result, QMI_WMS_PARAM_PROTOCOL,
- &data->msg_mode);
- } else {
- /* check both, start with 1 then switch to other */
- DBG("device supports CDMA and WCDMA msg protocol");
+ /* Get Message Protocol operation is not supported */
+ DBG("query both CDMA and WCDMA");
data->msg_mode_all = true;
data->msg_mode = QMI_WMS_MESSAGE_MODE_CDMA;
+ } else {
+ /* Query of current protocol succeeded, use that */
+ qmi_result_get_uint8(result, QMI_WMS_PARAM_PROTOCOL,
+ &data->msg_mode);
+
+ DBG("msg_mode: %s", data->msg_mode ? "WCDMA" : "CDMA");
}
/* check for messages */
--
2.43.0
next prev parent reply other threads:[~2024-03-19 16:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 16:42 [PATCH 1/2] qmimodem: Rework GET_CARD_STATUS retry logic Denis Kenzior
2024-03-19 16:42 ` Denis Kenzior [this message]
2024-03-19 22:30 ` patchwork-bot+ofono
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=20240319164309.2676887-2-denkenz@gmail.com \
--to=denkenz@gmail.com \
--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.