Merge "drivers: soc: qcom: msm_performance: Add NULL check in PLH function"

This commit is contained in:
qctecmdr 2021-04-19 12:09:46 -07:00 • committed by Gerrit - the friendly Code Review server
commit 640f36cbaf

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
*/
#include <linux/init.h>
@ -1009,6 +1009,8 @@ static int init_splh_notif(const char *buf)
cp = strnchr(cp, strlen(cp), ':'); /* skip INIT */
cp++;
cp = strnchr(cp, strlen(cp), ':'); /* skip nfps */
if (!cp)
return -EINVAL;
*ptmp++ = nfps; /* nfps is first cmd param */
tmp_valid_len++;
@ -1035,6 +1037,9 @@ static int init_splh_notif(const char *buf)
ptmp++; /* increment after storing FPS val */
tmp_valid_len++;
cp1 = strnchr(cp1, strlen(cp1), ','); /* move to ,ipc */
if (!cp1)
return -EINVAL;
for (j = 0; j < 2 * n_ipc_freq_pair; j++) {
if (sscanf(cp1, ",%hu", ptmp) != 1)
return -EINVAL;
@ -1042,12 +1047,20 @@ static int init_splh_notif(const char *buf)
ptmp++; /* increment after storing ipc or freq */
tmp_valid_len++;
cp1++;
if (j != (2 * n_ipc_freq_pair - 1))
if (j != (2 * n_ipc_freq_pair - 1)) {
cp1 = strnchr(cp1, strlen(cp1), ','); /* move to next */
if (!cp1)
return -EINVAL;
}
}
if (i != (nfps - 1))
if (i != (nfps - 1)) {
cp1 = strnchr(cp1, strlen(cp1), ':'); /* move to next FPS val */
if (!cp1)
return -EINVAL;
}
}
} else {