msm_perf: Handle out of bounds case

KASAN seems to be flagging that bool
would only be 1 byte while %du would
want to write 4 bytes leading to out
of bounds.

Change-Id: I0e43b1103b882bbd61b5a0bef231efcc3d7d1e1b
Signed-off-by: Badri Sampath <quic_badris@quicinc.com>
This commit is contained in:
Badri Sampath 2022-05-06 09:55:05 -07:00 committed by Gerrit - the friendly Code Review server
parent 8a22567035
commit d6a47b123a

View File

@ -927,7 +927,7 @@ static ssize_t set_core_ctl_register(struct kobject *kobj,
bool old_val = core_ctl_register;
int ret;
ret = sscanf(buf, "%du", &core_ctl_register);
ret = kstrtobool(buf, &core_ctl_register);
if (ret < 0) {
pr_err("msm_perf: getting new core_ctl_register failed, ret=%d\n", ret);
return ret;