From: Kalle Valo <kvalo@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Karthikeyan Periyasamy <periyasa@codeaurora.org>,
Jakub Kicinski <kuba@kernel.org>,
kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org,
ath11k@lists.infradead.org
Subject: Re: [PATCH net-next] ath11k: fix uninitialized return in ath11k_spectral_process_data()
Date: Mon, 22 Jun 2020 14:51:16 +0000 [thread overview]
Message-ID: <87a70vf923.fsf@codeaurora.org> (raw)
In-Reply-To: <20200619142922.GA267142@mwanda> (Dan Carpenter's message of "Fri, 19 Jun 2020 14:29:22 +0000 (UTC)")
Dan Carpenter <dan.carpenter@oracle.com> writes:
> There is a success path where "ret" isn't initialized where we never
> have a ATH11K_SPECTRAL_TAG_SCAN_SEARCH and then ret isn't initialized.
>
> Fixes: 9d11b7bff950 ("ath11k: add support for spectral scan")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/net/wireless/ath/ath11k/spectral.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/spectral.c b/drivers/net/wireless/ath/ath11k/spectral.c
> index 1c5d65bb411f..bfbf905f7507 100644
> --- a/drivers/net/wireless/ath/ath11k/spectral.c
> +++ b/drivers/net/wireless/ath/ath11k/spectral.c
> @@ -677,7 +677,7 @@ static int ath11k_spectral_process_data(struct ath11k *ar,
> u32 data_len, i;
> u8 sign, tag;
> int tlv_len, sample_sz;
> - int ret;
> + int ret = 0;
> bool quit = false;
I try to avoid initialising ret variables so I would like find another
way. What about doing this (completely untested!) in the end of the
function:
return 0;
err:
kfree(fft_sample);
unlock:
spin_unlock_bh(&ar->spectral.lock);
return ret;
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2020-06-22 14:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-19 14:29 [PATCH net-next] ath11k: fix uninitialized return in ath11k_spectral_process_data() Dan Carpenter
2020-06-22 14:51 ` Kalle Valo [this message]
2020-06-22 17:18 ` Dan Carpenter
2020-09-07 16:56 ` Kalle Valo
2020-09-09 6:49 ` 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=87a70vf923.fsf@codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=ath11k@lists.infradead.org \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=periyasa@codeaurora.org \
/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 NNTP newsgroup(s).