mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Liming Sun <limings@nvidia.com>,
	Vadim Pasternak <vadimp@nvidia.com>,
	David Thompson <davthompson@nvidia.com>,
	Mark Gross <markgross@kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] platform/mellanox: mlxbf-tmfifo: Fix a warning message
Date: Wed, 18 Oct 2023 15:41:51 +0200	[thread overview]
Message-ID: <f084c21c-bff2-c12f-f583-ba4bc42fdf9d@redhat.com> (raw)
In-Reply-To: <20231012230235.219861-1-limings@nvidia.com>

Hi,

On 10/13/23 01:02, Liming Sun wrote:
> This commit fixes the smatch static checker warning in function
> mlxbf_tmfifo_rxtx_word() which complains data not initialized at
> line 634 when IS_VRING_DROP() is TRUE.
> 
> Signed-off-by: Liming Sun <limings@nvidia.com>
> ---
> v1->v2: Logic adjustment for Hans's comment
>   - Adjust the logic to avoid confusion.

Thank you for your patch/series, I've applied this patch
(series) to the pdx86 fixes branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes

I will include this patch in my next fixes pull-req to Linus
for the current kernel development cycle.

Regards,

Hans






> v1: Initial version.
> ---
>  drivers/platform/mellanox/mlxbf-tmfifo.c | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c
> index f3696a54a2bd..d9615ad60012 100644
> --- a/drivers/platform/mellanox/mlxbf-tmfifo.c
> +++ b/drivers/platform/mellanox/mlxbf-tmfifo.c
> @@ -607,24 +607,25 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring,
>  
>  	if (vring->cur_len + sizeof(u64) <= len) {
>  		/* The whole word. */
> -		if (!IS_VRING_DROP(vring)) {
> -			if (is_rx)
> +		if (is_rx) {
> +			if (!IS_VRING_DROP(vring))
>  				memcpy(addr + vring->cur_len, &data,
>  				       sizeof(u64));
> -			else
> -				memcpy(&data, addr + vring->cur_len,
> -				       sizeof(u64));
> +		} else {
> +			memcpy(&data, addr + vring->cur_len,
> +			       sizeof(u64));
>  		}
>  		vring->cur_len += sizeof(u64);
>  	} else {
>  		/* Leftover bytes. */
> -		if (!IS_VRING_DROP(vring)) {
> -			if (is_rx)
> +		if (is_rx) {
> +			if (!IS_VRING_DROP(vring))
>  				memcpy(addr + vring->cur_len, &data,
>  				       len - vring->cur_len);
> -			else
> -				memcpy(&data, addr + vring->cur_len,
> -				       len - vring->cur_len);
> +		} else {
> +			data = 0;
> +			memcpy(&data, addr + vring->cur_len,
> +			       len - vring->cur_len);
>  		}
>  		vring->cur_len = len;
>  	}


      reply	other threads:[~2023-10-18 13:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05 12:18 [PATCH v1 1/1] " Liming Sun
2023-10-06 12:53 ` Hans de Goede
2023-10-06 15:50   ` Liming Sun
2023-10-06 17:06     ` Hans de Goede
2023-10-09 19:28       ` Liming Sun
2023-10-10  8:05         ` Hans de Goede
2023-10-12 23:03           ` Liming Sun
2023-10-12 23:02 ` [PATCH v2] " Liming Sun
2023-10-18 13:41   ` Hans de Goede [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=f084c21c-bff2-c12f-f583-ba4bc42fdf9d@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=dan.carpenter@linaro.org \
    --cc=davthompson@nvidia.com \
    --cc=limings@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vadimp@nvidia.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

all inboxes | Powered by JetHome®