Skip to contentSkip to conversation

gprs: netreg_status_changed: output the status as human readable string

PATCH In review Alexander Couzens 2 participants 3 messages Apr 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gprs: netreg_status_changed: output the status as human readable string

---
 src/gprs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/gprs.c +1 -1
index 148cbc979dfb..5f66cad591c1 100644
@@ -1700,7 +1700,7 @@ static void netreg_status_changed(int status, int lac, int ci, int tech,
 {
 	struct ofono_gprs *gprs = data;
 
-	DBG("%d", status);
+	DBG("%d (%s)", status, registration_status_to_string(status));
 
 	gprs->netreg_status = status;
 
Signature · 1 line
2.21.0
#1 lore raw

PATCH 2/2 qmi: netmon: fix crashs on get_rssi_cb when BER or RSSI are empty

The message can be emitted without the fields being present. In this case ber or rssi are 0 resulting in a null pointer deref.

---
 drivers/qmimodem/netmon.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/qmimodem/netmon.c +2 -2
index 14a55632e8a6..729879ce73d8 100644
@@ -89,8 +89,8 @@ static void get_rssi_cb(struct qmi_result *result, void *user_data)
 
 	/* RSSI */
 	rssi = qmi_result_get(result, 0x11, &len);
-	num = GUINT16_FROM_LE(rssi->count);
 	if (rssi) {
+		num = GUINT16_FROM_LE(rssi->count);
 		for (i = 0; i < num; i++) {
 			DBG("RSSI: %hhu on RAT %hhd",
 				rssi->info[i].rssi,
@@ -126,8 +126,8 @@ static void get_rssi_cb(struct qmi_result *result, void *user_data)
 
 	/* Bit error rate */
 	ber = qmi_result_get(result, 0x15, &len);
-	num = GUINT16_FROM_LE(ber->count);
 	if (ber) {
+		num = GUINT16_FROM_LE(ber->count);
 		for (i = 0; i < ber->count; i++) {
 			DBG("Bit error rate: %hu on RAT %hhd",
 				GUINT16_FROM_LE(ber->info[i].rate),
Signature · 1 line
2.21.0