All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Saurav Girepunje <saurav.girepunje@gmail.com>
Cc: vireshk@kernel.org, johan@kernel.org, elder@kernel.org,
	gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	saurav.girepunje@hotmail.com
Subject: Re: [PATCH] staging: greybus: bootrom: fix uninitialized variables
Date: Sat, 25 Jan 2020 11:00:11 +0100	[thread overview]
Message-ID: <20200125100011.GK8375@localhost> (raw)
In-Reply-To: <20200125084403.GA3386@google.com>

On Sat, Jan 25, 2020 at 02:14:03PM +0530, Saurav Girepunje wrote:
> fix uninitialized variables issue found using static code analysis tool

Which tool is that?

> (error) Uninitialized variable: offset
> (error) Uninitialized variable: size
>
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>   drivers/staging/greybus/bootrom.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
> index a8efb86..9eabeb3 100644
> --- a/drivers/staging/greybus/bootrom.c
> +++ b/drivers/staging/greybus/bootrom.c
> @@ -245,7 +245,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
>   	struct gb_bootrom_get_firmware_request *firmware_request;
>   	struct gb_bootrom_get_firmware_response *firmware_response;
>   	struct device *dev = &op->connection->bundle->dev;
> -	unsigned int offset, size;
> +	unsigned int offset = 0, size = 0;
>   	enum next_request_type next_request;
>   	int ret = 0;

I think this has come up in the past, and while the code in question is
overly complicated and confuses static checkers as well as humans, it
looks correct to me.

Please make sure to verify the output of any tools before posting
patches based on them.

Johan

WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: Saurav Girepunje <saurav.girepunje@gmail.com>
Cc: devel@driverdev.osuosl.org, elder@kernel.org, vireshk@kernel.org,
	johan@kernel.org, linux-kernel@vger.kernel.org,
	greybus-dev@lists.linaro.org, saurav.girepunje@hotmail.com,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH] staging: greybus: bootrom: fix uninitialized variables
Date: Sat, 25 Jan 2020 11:00:11 +0100	[thread overview]
Message-ID: <20200125100011.GK8375@localhost> (raw)
In-Reply-To: <20200125084403.GA3386@google.com>

On Sat, Jan 25, 2020 at 02:14:03PM +0530, Saurav Girepunje wrote:
> fix uninitialized variables issue found using static code analysis tool

Which tool is that?

> (error) Uninitialized variable: offset
> (error) Uninitialized variable: size
>
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>   drivers/staging/greybus/bootrom.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
> index a8efb86..9eabeb3 100644
> --- a/drivers/staging/greybus/bootrom.c
> +++ b/drivers/staging/greybus/bootrom.c
> @@ -245,7 +245,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
>   	struct gb_bootrom_get_firmware_request *firmware_request;
>   	struct gb_bootrom_get_firmware_response *firmware_response;
>   	struct device *dev = &op->connection->bundle->dev;
> -	unsigned int offset, size;
> +	unsigned int offset = 0, size = 0;
>   	enum next_request_type next_request;
>   	int ret = 0;

I think this has come up in the past, and while the code in question is
overly complicated and confuses static checkers as well as humans, it
looks correct to me.

Please make sure to verify the output of any tools before posting
patches based on them.

Johan
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply	other threads:[~2020-01-25 10:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-25  8:44 [PATCH] staging: greybus: bootrom: fix uninitialized variables Saurav Girepunje
2020-01-25  8:44 ` Saurav Girepunje
2020-01-25 10:00 ` Johan Hovold [this message]
2020-01-25 10:00   ` Johan Hovold
2020-01-25 12:14   ` SAURAV GIREPUNJE
2020-01-25 12:14     ` SAURAV GIREPUNJE
2020-01-27 14:10     ` [greybus-dev] " Alex Elder
2020-01-27 14:10       ` Alex Elder
2020-01-27  8:09 ` Dan Carpenter
2020-01-27  8:09   ` Dan Carpenter

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=20200125100011.GK8375@localhost \
    --to=johan@kernel.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=saurav.girepunje@gmail.com \
    --cc=saurav.girepunje@hotmail.com \
    --cc=vireshk@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.