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.
This commit is contained in:
Alexander Couzens 2019-04-28 13:28:15 +02:00 committed by Denis Kenzior
parent d604052cef
commit 64df5344c5
1 changed files with 2 additions and 2 deletions

View File

@ -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),