ATH11K Archive mirror
 help / color / mirror / Atom feed
From: Jeff Johnson <quic_jjohnson@quicinc.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Kalle Valo <kvalo@kernel.org>, Tom Rix <trix@redhat.com>,
	<linux-wireless@vger.kernel.org>, <lvc-project@linuxtesting.org>,
	<ath11k@lists.infradead.org>
Subject: Re: [PATCH 4/5] wifi: ath11k: use kstrtoul_from_user() where appropriate
Date: Thu, 24 Aug 2023 10:46:06 -0700	[thread overview]
Message-ID: <10733baf-fa3d-452d-a6da-f40a416658a1@quicinc.com> (raw)
In-Reply-To: <20230824075121.121144-4-dmantipov@yandex.ru>

On 8/24/2023 12:50 AM, Dmitry Antipov wrote:
> Use 'kstrtoul_from_user()' in 'ath11k_write_file_spectral_count()'
> and 'ath11k_write_file_spectral_bins()'
> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>

> ---
>   drivers/net/wireless/ath/ath11k/spectral.c | 26 +++++++---------------
>   1 file changed, 8 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/spectral.c b/drivers/net/wireless/ath/ath11k/spectral.c
> index 97eb2a457685..b5530e484507 100644
> --- a/drivers/net/wireless/ath/ath11k/spectral.c
> +++ b/drivers/net/wireless/ath/ath11k/spectral.c
> @@ -382,16 +382,11 @@ static ssize_t ath11k_write_file_spectral_count(struct file *file,
>   {
>   	struct ath11k *ar = file->private_data;
>   	unsigned long val;
> -	char buf[32];
> -	ssize_t len;
> -
> -	len = min(count, sizeof(buf) - 1);
> -	if (copy_from_user(buf, user_buf, len))
> -		return -EFAULT;
> +	ssize_t ret;
>   
> -	buf[len] = '\0';
> -	if (kstrtoul(buf, 0, &val))
> -		return -EINVAL;
> +	ret = kstrtoul_from_user(user_buf, count, 0, &val);
> +	if (ret)
> +		return ret;
>   
>   	if (val > ATH11K_SPECTRAL_SCAN_COUNT_MAX)
>   		return -EINVAL;
> @@ -437,16 +432,11 @@ static ssize_t ath11k_write_file_spectral_bins(struct file *file,
>   {
>   	struct ath11k *ar = file->private_data;
>   	unsigned long val;
> -	char buf[32];
> -	ssize_t len;
> -
> -	len = min(count, sizeof(buf) - 1);
> -	if (copy_from_user(buf, user_buf, len))
> -		return -EFAULT;
> +	ssize_t ret;
>   
> -	buf[len] = '\0';
> -	if (kstrtoul(buf, 0, &val))
> -		return -EINVAL;
> +	ret = kstrtoul_from_user(user_buf, count, 0, &val);
> +	if (ret)
> +		return ret;
>   
>   	if (val < ATH11K_SPECTRAL_MIN_BINS ||
>   	    val > ar->ab->hw_params.spectral.max_fft_bins)


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

  reply	other threads:[~2023-08-24 17:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24  7:50 [PATCH 1/5] wifi: ath11k: drop redundant check in ath11k_dp_rx_mon_dest_process() Dmitry Antipov
2023-08-24  7:50 ` [PATCH 2/5] wifi: ath11k: remove unused members of 'struct ath11k_base' Dmitry Antipov
2023-08-24 17:54   ` Jeff Johnson
2023-08-24  7:50 ` [PATCH 3/5] wifi: ath11k: simplify spectral pull functions Dmitry Antipov
2023-08-24 17:39   ` Jeff Johnson
2023-08-24  7:50 ` [PATCH 4/5] wifi: ath11k: use kstrtoul_from_user() where appropriate Dmitry Antipov
2023-08-24 17:46   ` Jeff Johnson [this message]
2023-09-28 14:25   ` Kalle Valo
2023-08-24  7:50 ` [PATCH 5/5] wifi: ath11k: fix stack usage of ath11k_mac_op_remain_on_channel() Dmitry Antipov
2023-08-24 17:53   ` Jeff Johnson
2023-08-24 15:30 ` [PATCH 1/5] wifi: ath11k: drop redundant check in ath11k_dp_rx_mon_dest_process() Jeff Johnson
2023-09-21  8:15 ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10733baf-fa3d-452d-a6da-f40a416658a1@quicinc.com \
    --to=quic_jjohnson@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=dmantipov@yandex.ru \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).