From bb6bd7c418622e392230ec6cfd1dbd21ea58f14f Mon Sep 17 00:00:00 2001 From: Jay Jayanna Date: Tue, 9 Mar 2021 13:29:44 -0800 Subject: [PATCH] soc: qcom: qmp-debugfs-client: Remove leading and trailing whitespaces Remove all the leading and trailing whitespaces in the string copied from userspace. Change-Id: I627416dcdb1155303ad6a8ed172910a8653dd67b Signed-off-by: Jay Jayanna --- drivers/soc/qcom/qmp-debugfs-client.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/qmp-debugfs-client.c b/drivers/soc/qcom/qmp-debugfs-client.c index 35ce693a0da2..d4dfc40fe535 100644 --- a/drivers/soc/qcom/qmp-debugfs-client.c +++ b/drivers/soc/qcom/qmp-debugfs-client.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. */ +/* Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved. */ #include #include @@ -48,6 +48,11 @@ static ssize_t aop_msg_write(struct file *file, const char __user *userstr, return len; } + /* + * Trim the leading and trailing white spaces + */ + strim(data_pkt[count].buf); + /* * Controller expects a 4 byte aligned buffer */