public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	Mihail Chindris <mihail.chindris@analog.com>,
	linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] iio: Fix uninitialized variable ret
Date: Sun, 17 Oct 2021 12:37:49 +0100	[thread overview]
Message-ID: <20211017123749.5e6c3bde@jic23-huawei> (raw)
In-Reply-To: <20211015153254.33783-1-colin.king@canonical.com>

On Fri, 15 Oct 2021 16:32:54 +0100
Colin King <colin.king@canonical.com> wrote:

> From: Colin Ian King <colin.king@canonical.com>
> 
> When !iio_buffer_space_available(rb) is true and signal_pending(current)
> is false the end of the do-while loop is reached and the uninitialized
> variable ret is zero checked. Fix this by initializing variable ret to
> zero.
> 
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: ffabbffd40f2 ("iio: Add output buffer support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Looks like the correct fix to me. If anyone disagrees shout soon!

Applied to the iio-togreg branch of iio.git and pushed out as testing for 0-day
to poke at it.

Jonathan

> ---
>  drivers/iio/industrialio-buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index b884d78657cb..c97fb8462395 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -179,7 +179,7 @@ static ssize_t iio_buffer_write(struct file *filp, const char __user *buf,
>  	struct iio_buffer *rb = ib->buffer;
>  	struct iio_dev *indio_dev = ib->indio_dev;
>  	DEFINE_WAIT_FUNC(wait, woken_wake_function);
> -	int ret;
> +	int ret = 0;
>  	size_t written;
>  
>  	if (!indio_dev->info)


      reply	other threads:[~2021-10-17 11:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 15:32 [PATCH][next] iio: Fix uninitialized variable ret Colin King
2021-10-17 11:37 ` Jonathan Cameron [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=20211017123749.5e6c3bde@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mihail.chindris@analog.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