From patchwork Wed Jun 26 15:18:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 11018097 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2409B13AF for ; Wed, 26 Jun 2019 15:18:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F82E28673 for ; Wed, 26 Jun 2019 15:18:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03FBF288B3; Wed, 26 Jun 2019 15:18:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AAFF028673 for ; Wed, 26 Jun 2019 15:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=URrNbveNTH2CnaCYep2r/2jcMjoVpnwbzci3C+eO2kc=; b=bTjEXr0bAbG6i3 Nj7kTfjFb7L2W4IJLr+3cVUEb2XeANz2lhr+64xXvuwh6Fw2rrSrzQh+Y9JDgOrhYeN7b8ZH8ahDQ HZXPgS80Ua3KB6IPZBoy4umwteBQLEJVn/ABpqYtSGYFABuJAScs+SCYORz7bwU1bkdgSLHm6E9Lt U7vvSAreGl2igY+im1bBj7K3mlDaZqoedBtuWi5SoPWJwfn408vFpbOKGCXGOZyWWxe343l/3j1NK acG2VLpDcMp72GCVc6K+nWYI9w4ps634AFRTMfUnRLt5H+mRM5HGEkVVaPA1jLx6CuZLbL4amMwRy DH8XC20Zmfpz/DBwNELg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hg9gq-0006gl-QW; Wed, 26 Jun 2019 15:18:28 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hg9gn-0006eU-Hu for ath11k@lists.infradead.org; Wed, 26 Jun 2019 15:18:26 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 553CC60CF0; Wed, 26 Jun 2019 15:18:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1561562305; bh=tw4JGJU2h3EjgKUFahQIjYXI9mcocBNo6vNUOJ4aMUE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=daWVE3K++vD6l1N44G/OQRnluEC4evGS81owuuAlbd4hWukYHkywLr8BRIQWeJ3ft +Hqy4brLl7J9x6W29eeAIvA8duCaB8G1M0feazrmyy6qrfoBvYVKsY5dbT1FO31yTj zAu0k6S45iKVOejg+gPz10Bf+7rE79CEAG4kmOsU= Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6B13760A05 for ; Wed, 26 Jun 2019 15:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1561562305; bh=tw4JGJU2h3EjgKUFahQIjYXI9mcocBNo6vNUOJ4aMUE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=daWVE3K++vD6l1N44G/OQRnluEC4evGS81owuuAlbd4hWukYHkywLr8BRIQWeJ3ft +Hqy4brLl7J9x6W29eeAIvA8duCaB8G1M0feazrmyy6qrfoBvYVKsY5dbT1FO31yTj zAu0k6S45iKVOejg+gPz10Bf+7rE79CEAG4kmOsU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6B13760A05 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: ath11k@lists.infradead.org Subject: [PATCH 4/4] ath11k: use kstrtoint_from_user() instead of sscanf() Date: Wed, 26 Jun 2019 18:18:15 +0300 Message-Id: <1561562295-17402-4-git-send-email-kvalo@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561562295-17402-1-git-send-email-kvalo@codeaurora.org> References: <1561562295-17402-1-git-send-email-kvalo@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190626_081825_605433_A6966DA1 X-CRM114-Status: GOOD ( 10.49 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Fix checkpatch warning: drivers/net/wireless/ath/ath11k/debugfs_sta.c:494: Prefer kstrto to single variable sscanf As kstrtoint_from_user() can read directly from user buffer no need copy the buffer separately. Compile tested only. Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath11k/debugfs_sta.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/debugfs_sta.c b/drivers/net/wireless/ath/ath11k/debugfs_sta.c index 4a30293bbae4..82bada5a7479 100644 --- a/drivers/net/wireless/ath/ath11k/debugfs_sta.c +++ b/drivers/net/wireless/ath/ath11k/debugfs_sta.c @@ -467,15 +467,13 @@ static const struct file_operations fops_htt_peer_stats = { }; static ssize_t ath11k_dbg_sta_write_peer_pktlog(struct file *file, - const char __user *ubuf, + const char __user *buf, size_t count, loff_t *ppos) { struct ieee80211_sta *sta = file->private_data; struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; struct ath11k *ar = arsta->arvif->ar; - u8 buf[32] = {0}; int ret, enable; - ssize_t rc; mutex_lock(&ar->conf_mutex); @@ -484,18 +482,9 @@ static ssize_t ath11k_dbg_sta_write_peer_pktlog(struct file *file, goto out; } - rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count); - if (rc < 0) { - ret = rc; + ret = kstrtoint_from_user(buf, count, 0, &enable); + if (ret) goto out; - } - buf[rc] = '\0'; - - ret = sscanf(buf, "%d", &enable); - if (ret != 1) { - ret = -EINVAL; - goto out; - } ar->debug.pktlog_peer_valid = enable; memcpy(ar->debug.pktlog_peer_addr, sta->addr, ETH_ALEN);