From: "Jérôme Pouiller" <jerome.pouiller@silabs.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, Colin King <colin.king@canonical.com>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] staging: wfx: fix uninitialized variable bytes_done
Date: Mon, 06 Jul 2020 13:29:19 +0000 [thread overview]
Message-ID: <6155735.5LkVgl88Ba@pc-42> (raw)
In-Reply-To: <20200706132017.487627-1-colin.king@canonical.com>
On Monday 6 July 2020 15:20:17 CEST Colin King wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The variable bytes_done is not initialized and hence the first
> FIFO size check on bytes_done may be breaking prematurely from
> the loop if bytes_done contains a large bogus uninitialized value.
> Fix this by initializing bytes_done to zero.
>
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: a9408ad79ff3 ("staging: wfx: load the firmware faster")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Good catch!
I am surprised that my gcc hasn't caught that.
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
> ---
> drivers/staging/wfx/fwio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c
> index d9a886f3e64b..206c6cf6511c 100644
> --- a/drivers/staging/wfx/fwio.c
> +++ b/drivers/staging/wfx/fwio.c
> @@ -177,7 +177,7 @@ static int wait_ncp_status(struct wfx_dev *wdev, u32 status)
> static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
> {
> int ret;
> - u32 offs, bytes_done;
> + u32 offs, bytes_done = 0;
> ktime_t now, start;
>
> if (len % DNLD_BLOCK_SIZE) {
> --
> 2.27.0
>
>
--
Jérôme Pouiller
prev parent reply other threads:[~2020-07-06 13:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 13:20 [PATCH][next] staging: wfx: fix uninitialized variable bytes_done Colin King
2020-07-06 13:29 ` Jérôme Pouiller [this message]
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=6155735.5LkVgl88Ba@pc-42 \
--to=jerome.pouiller@silabs.com \
--cc=colin.king@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).