Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp928804rdd; Wed, 10 Jan 2024 04:01:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6QYaoi3nsJznl/2pTPwRtSIjhFOiQjU+9qoq4QF+tqVX4oE3ixeZI3/CAg9QdO6zMOWdf X-Received: by 2002:a05:6102:f07:b0:467:f9e9:3e30 with SMTP id v7-20020a0561020f0700b00467f9e93e30mr355302vss.44.1704888098521; Wed, 10 Jan 2024 04:01:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704888098; cv=none; d=google.com; s=arc-20160816; b=oGyfzul8C3i/X5a9NU0t0Z+Xdy33aMPMaKxF0Mh+pwtYpfHsR3rjgMj46u+ISY9UeG oIdXqyDWndVbT7TBvL/gPFXDtOIzTTyCyKYeds9WIkSo9ubf5XdGrGqfHLyZeDEfa8vW nuM6YDpoLXdnO11RfDWaR5HhBivEsT5julQ47zJTGa5Dkb/q+j5DG3iwevWlvl34ZU6w MdC4rYVuS8YZ9HAWIqg145OmmofVT8i47PXx3F8BOmou3kiQVNncEVl9PcPLQzJpWl4T cTtGE8FWUaUy0QpmxdYfmxqcjedn3HNkyGgHddBVVdxGNkQRpZhyUtRiThwd5LBvfFHF Spgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=7Rzw0yOYbXR448P7VBVS8s0ZMczc6x3BvrVsOrngqBg=; fh=HySTcCODMyh3LHuPeWAx8lSJ+4JZqdiJHqUmwtCuXpc=; b=LLYjZaxhSncwBV/OegW1El3TbmmoM7gdxKK6D8QkTizup3qn5vnEwup7Mbsd4yqIjw 8WjlQW8E7CQMRnErJOkKqdFEAD3RazhJEUBatNMJM0B0nRou2mEyU6i6RIWM4ve5YOne 4bJrLNubc4ZLmRD3+1UpFzOl7nk0TSu7Cs5ZQnL3RYonZ85eOI8VZBkTv4bWEf52ZbAK h6jlW17brG2jMw3+4vvwws4Z25cvn0jSPq5jUUtEiOfhFCvrAcpzvFR8K6813/zkI0CL SY0HO4O/P3RiF50Cbz31FUl4kWLwyA1ek6n88JkbdliV8YcpKlpn9AbBPpqkxI8OcaOQ TH+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=MrY5VSu6; spf=pass (google.com: domain of linux-wireless+bounces-1659-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1659-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dh5-20020a056130250500b007ce7469bba1si468620uab.214.2024.01.10.04.01.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 04:01:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1659-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=MrY5VSu6; spf=pass (google.com: domain of linux-wireless+bounces-1659-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1659-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2AC6A1C20F7B for ; Wed, 10 Jan 2024 12:01:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E32647F47; Wed, 10 Jan 2024 12:01:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="MrY5VSu6" X-Original-To: linux-wireless@vger.kernel.org Received: from forward205c.mail.yandex.net (forward205c.mail.yandex.net [178.154.239.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACE1647F5D for ; Wed, 10 Jan 2024 12:01:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Received: from forward102c.mail.yandex.net (forward102c.mail.yandex.net [IPv6:2a02:6b8:c03:500:1:45:d181:d102]) by forward205c.mail.yandex.net (Yandex) with ESMTP id 1BBEF6651A for ; Wed, 10 Jan 2024 14:54:54 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-45.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-45.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:c83:0:640:84f9:0]) by forward102c.mail.yandex.net (Yandex) with ESMTP id 8AB7060AB0; Wed, 10 Jan 2024 14:54:45 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-45.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id hsgknrDjA8c0-CAT8gXYb; Wed, 10 Jan 2024 14:54:44 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1704887685; bh=7Rzw0yOYbXR448P7VBVS8s0ZMczc6x3BvrVsOrngqBg=; h=Message-ID:Date:Cc:Subject:To:From; b=MrY5VSu6Ku9bZjil6vnqEJT+2DhbBjwiwpmmsbYiz5c0o9Twk4mE/ZGLjzRkoB02j cNHebFaAAi1Ppn9sPA7CwuC0bisewWUsRtHvyLzBDUnE1m8VJUkQZgSEDqH2GzNXIm JetLzxXToFXeCwqpB34mw2+Eg6vXUj2kXTFIPDtw= Authentication-Results: mail-nwsmtp-smtp-production-main-45.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: David Lin Cc: Brian Norris , Kalle Valo , linux-wireless@vger.kernel.org, Dmitry Antipov Subject: [PATCH] wifi: mwifiex: use kstrtoX_from_user() in debugfs handlers Date: Wed, 10 Jan 2024 14:53:11 +0300 Message-ID: <20240110115314.421298-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use convenient 'kstrtou32_from_user()' in 'mwifiex_verext_write()' and 'kstrtobool_from_user()' in 'mwifiex_timeshare_coex_write()', respectively. Compile tested only. Signed-off-by: Dmitry Antipov --- .../net/wireless/marvell/mwifiex/debugfs.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c index f9c9fec7c792..46061bfd0c84 100644 --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c @@ -566,14 +566,8 @@ mwifiex_verext_write(struct file *file, const char __user *ubuf, int ret; u32 versionstrsel; struct mwifiex_private *priv = (void *)file->private_data; - char buf[16]; - memset(buf, 0, sizeof(buf)); - - if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) - return -EFAULT; - - ret = kstrtou32(buf, 10, &versionstrsel); + ret = kstrtou32_from_user(ubuf, count, 10, &versionstrsel); if (ret) return ret; @@ -874,19 +868,14 @@ mwifiex_timeshare_coex_write(struct file *file, const char __user *ubuf, { bool timeshare_coex; struct mwifiex_private *priv = file->private_data; - char kbuf[16]; int ret; if (priv->adapter->fw_api_ver != MWIFIEX_FW_V15) return -EOPNOTSUPP; - memset(kbuf, 0, sizeof(kbuf)); - - if (copy_from_user(&kbuf, ubuf, min_t(size_t, sizeof(kbuf) - 1, count))) - return -EFAULT; - - if (kstrtobool(kbuf, ×hare_coex)) - return -EINVAL; + ret = kstrtobool_from_user(ubuf, count, ×hare_coex); + if (ret) + return ret; ret = mwifiex_send_cmd(priv, HostCmd_CMD_ROBUST_COEX, HostCmd_ACT_GEN_SET, 0, ×hare_coex, true); -- 2.43.0