Skip to contentSkip to conversation

Fix issues found with static analyzer

PATCH Applied Max Rudik 2 participants 6 messages Jul 16, 2024 – Jul 18, 2024

lore
Share & tools
lore

Max Rudik

author
#0 lore raw

cover Fix issues found with static analyzer

This patch series fixes several minor issues found with SVACE static analyzer.

Max Rudik (4):
stemodem: Fix possible NULL dereference
cbs: Fix possible NULL dereference
stk: Fix possible NULL dereference
call-settings: Fix typo

 drivers/stemodem/gprs-context.c | 4 ++++
 src/call-settings.c             | 2 +-
 src/cbs.c                       | 2 +-
 src/stk.c                       | 3 +++
 4 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/4 stemodem: Fix possible NULL dereference

---
 drivers/stemodem/gprs-context.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/stemodem/gprs-context.c +4 -0
index a23c6f83..58085f5b 100644
@@ -193,6 +193,10 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	for (i = 0; i < g_at_result_num_response_lines(result); i++) {
 		g_at_result_iter_next(&iter, NULL);
 		res_string = g_at_result_iter_raw_line(&iter);
+
+		if (res_string == NULL)
+			goto error;
+
 		length = strlen(res_string);
 
 		if (!g_markup_parse_context_parse(context, res_string,
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/4 cbs: Fix possible NULL dereference

In reply to Max Rudik
---
 src/cbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/cbs.c +1 -1
index 760fd860..246157b1 100644
@@ -593,7 +593,7 @@ static void cbs_unregister(struct ofono_atom *atom)
 		cbs->settings = NULL;
 	}
 
-	if (cbs->netreg_watch) {
+	if (cbs->netreg_watch && cbs->netreg) {
 		if (cbs->location_watch) {
 			__ofono_netreg_remove_status_watch(cbs->netreg,
 							cbs->location_watch);
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/4 stk: Fix possible NULL dereference

In reply to Max Rudik
---
 src/stk.c | 3 +++
 1 file changed, 3 insertions(+)
src/stk.c +3 -0
index 70e8ae30..083920a3 100644
@@ -121,6 +121,9 @@ static int stk_respond(struct ofono_stk *stk, struct stk_response *rsp,
 	if (stk->driver->terminal_response == NULL)
 		return -ENOSYS;
 
+	if (stk->pending_cmd == NULL)
+		return -EINVAL;
+
 	rsp->src = STK_DEVICE_IDENTITY_TYPE_TERMINAL;
 	rsp->dst = STK_DEVICE_IDENTITY_TYPE_UICC;
 	rsp->number = stk->pending_cmd->number;
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 4/4 call-settings: Fix typo

In reply to Max Rudik
---
 src/call-settings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/call-settings.c +1 -1
index 123ccb68..f9061003 100644
@@ -494,7 +494,7 @@ static gboolean cw_ss_control(int type,
 		goto error;
 	}
 
-	if (strlen(sib) || strlen(sib) || strlen(dn))
+	if (strlen(sib) || strlen(sic) || strlen(dn))
 		goto bad_format;
 
 	if ((type == SS_CONTROL_TYPE_QUERY && cs->driver->cw_query == NULL) ||
Signature · 1 line
2.34.1
#5 lore raw
In reply to Max Rudik
This series was applied to ofono.git (master) by Denis Kenzior <[email protected]>:

Hello:

This series was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:

Quoted 10 lines · On Tue, 16 Jul 2024 13:11:32 +0300 you wrote:

This patch series fixes several minor issues found with SVACE static analyzer.

Max Rudik (4):
stemodem: Fix possible NULL dereference
cbs: Fix possible NULL dereference
stk: Fix possible NULL dereference
call-settings: Fix typo

[...]

Here is the summary with links:
- [1/4] stemodem: Fix possible NULL dereference

    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=8bd3d6573a85
  - [2/4] cbs: Fix possible NULL dereference
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=5b528ee0fa69
  - [3/4] stk: Fix possible NULL dereference
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=a4efa493a6aa
  - [4/4] call-settings: Fix typo
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=40eb7863661a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html