All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Donnellan <ajd@linux.ibm.com>
To: xiakaixu1987@gmail.com, fbarrat@linux.ibm.com,
	mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Kaixu Xia <kaixuxia@tencent.com>
Subject: Re: [PATCH] powerpc/powernv/sriov: fix unsigned int win compared to less than zero
Date: Tue, 10 Nov 2020 23:01:01 +1100	[thread overview]
Message-ID: <40b8ba6f-4916-55c2-a1f0-b7daa3c2e201@linux.ibm.com> (raw)
In-Reply-To: <1605007170-22171-1-git-send-email-kaixuxia@tencent.com>

On 10/11/20 10:19 pm, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> Fix coccicheck warning:
> 
> ./arch/powerpc/platforms/powernv/pci-sriov.c:443:7-10: WARNING: Unsigned expression compared with zero: win < 0
> ./arch/powerpc/platforms/powernv/pci-sriov.c:462:7-10: WARNING: Unsigned expression compared with zero: win < 0
> 
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

This seems like the right fix, the value assigned to win can indeed be 
-1 so it should be signed. Thanks for sending the patch.

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>   arch/powerpc/platforms/powernv/pci-sriov.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/platforms/powernv/pci-sriov.c
> index c4434f20f42f..92fc861c528f 100644
> --- a/arch/powerpc/platforms/powernv/pci-sriov.c
> +++ b/arch/powerpc/platforms/powernv/pci-sriov.c
> @@ -422,7 +422,7 @@ static int pnv_pci_vf_assign_m64(struct pci_dev *pdev, u16 num_vfs)
>   {
>   	struct pnv_iov_data   *iov;
>   	struct pnv_phb        *phb;
> -	unsigned int           win;
> +	int		       win;
>   	struct resource       *res;
>   	int                    i, j;
>   	int64_t                rc;
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Donnellan <ajd@linux.ibm.com>
To: xiakaixu1987@gmail.com, fbarrat@linux.ibm.com,
	mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org
Cc: Kaixu Xia <kaixuxia@tencent.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/powernv/sriov: fix unsigned int win compared to less than zero
Date: Tue, 10 Nov 2020 23:01:01 +1100	[thread overview]
Message-ID: <40b8ba6f-4916-55c2-a1f0-b7daa3c2e201@linux.ibm.com> (raw)
In-Reply-To: <1605007170-22171-1-git-send-email-kaixuxia@tencent.com>

On 10/11/20 10:19 pm, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> Fix coccicheck warning:
> 
> ./arch/powerpc/platforms/powernv/pci-sriov.c:443:7-10: WARNING: Unsigned expression compared with zero: win < 0
> ./arch/powerpc/platforms/powernv/pci-sriov.c:462:7-10: WARNING: Unsigned expression compared with zero: win < 0
> 
> Reported-by: Tosk Robot <tencent_os_robot@tencent.com>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

This seems like the right fix, the value assigned to win can indeed be 
-1 so it should be signed. Thanks for sending the patch.

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>   arch/powerpc/platforms/powernv/pci-sriov.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci-sriov.c b/arch/powerpc/platforms/powernv/pci-sriov.c
> index c4434f20f42f..92fc861c528f 100644
> --- a/arch/powerpc/platforms/powernv/pci-sriov.c
> +++ b/arch/powerpc/platforms/powernv/pci-sriov.c
> @@ -422,7 +422,7 @@ static int pnv_pci_vf_assign_m64(struct pci_dev *pdev, u16 num_vfs)
>   {
>   	struct pnv_iov_data   *iov;
>   	struct pnv_phb        *phb;
> -	unsigned int           win;
> +	int		       win;
>   	struct resource       *res;
>   	int                    i, j;
>   	int64_t                rc;
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited

  reply	other threads:[~2020-11-10 12:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 11:19 [PATCH] powerpc/powernv/sriov: fix unsigned int win compared to less than zero xiakaixu1987
2020-11-10 11:19 ` xiakaixu1987
2020-11-10 12:01 ` Andrew Donnellan [this message]
2020-11-10 12:01   ` Andrew Donnellan
2020-11-17  3:07   ` Michael Ellerman
2020-11-17  3:07     ` Michael Ellerman
2020-11-25 11:58 ` Michael Ellerman
2020-11-25 11:58   ` Michael Ellerman

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=40b8ba6f-4916-55c2-a1f0-b7daa3c2e201@linux.ibm.com \
    --to=ajd@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=fbarrat@linux.ibm.com \
    --cc=kaixuxia@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=xiakaixu1987@gmail.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 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.