Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16e57e65 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: qti-haptics: ensure valid pointer when calling kfree"

parents 1b28a7b8 ecc683a9
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/debugfs.h>
@@ -1687,11 +1687,11 @@ static ssize_t brake_pattern_dbgfs_write(struct file *filep,
{
	struct qti_hap_effect *effect =
		(struct qti_hap_effect *)filep->private_data;
	char *kbuf, *token;
	char *kbuf, *str, *token;
	int rc = 0, i = 0, j;
	u32 val;

	kbuf = kmalloc(count + 1, GFP_KERNEL);
	kbuf = kzalloc(count + 1, GFP_KERNEL);
	if (!kbuf)
		return -ENOMEM;

@@ -1703,8 +1703,8 @@ static ssize_t brake_pattern_dbgfs_write(struct file *filep,

	kbuf[count] = '\0';
	*ppos += count;

	while ((token = strsep(&kbuf, " ")) != NULL) {
	str = kbuf;
	while ((token = strsep(&str, " ")) != NULL) {
		rc = kstrtouint(token, 0, &val);
		if (rc < 0) {
			rc = -EINVAL;
@@ -1770,11 +1770,11 @@ static ssize_t pattern_dbgfs_write(struct file *filep,
{
	struct qti_hap_effect *effect =
		(struct qti_hap_effect *)filep->private_data;
	char *kbuf, *token;
	char *kbuf, *str, *token;
	int rc = 0, i = 0, j;
	u32 val;

	kbuf = kmalloc(count + 1, GFP_KERNEL);
	kbuf = kzalloc(count + 1, GFP_KERNEL);
	if (!kbuf)
		return -ENOMEM;

@@ -1786,8 +1786,8 @@ static ssize_t pattern_dbgfs_write(struct file *filep,

	kbuf[count] = '\0';
	*ppos += count;

	while ((token = strsep(&kbuf, " ")) != NULL) {
	str = kbuf;
	while ((token = strsep(&str, " ")) != NULL) {
		rc = kstrtouint(token, 0, &val);
		if (rc < 0) {
			rc = -EINVAL;