linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: ibmvsm: Fix wrong assignment of return code
@ 2018-08-06 13:31 Bryant G. Ly
  2018-08-07 12:28 ` Michael Ellerman
  0 siblings, 1 reply; 3+ messages in thread
From: Bryant G. Ly @ 2018-08-06 13:31 UTC (permalink / raw)
  To: gregkh; +Cc: linuxppc-dev, linux-kernel, Bryant G. Ly

From: "Bryant G. Ly" <bryantly@linux.ibm.com>

Currently the assignment is flipped and rc is always 0.

Signed-off-by: Bryant G. Ly <bryantly@linux.ibm.com>
Reviewed-by: Bradley Warrum <bwarrum@us.ibm.com>
---
 drivers/misc/ibmvmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
index 8f82bb9..b8aaa68 100644
--- a/drivers/misc/ibmvmc.c
+++ b/drivers/misc/ibmvmc.c
@@ -2131,7 +2131,7 @@ static int ibmvmc_init_crq_queue(struct crq_server_adapter *adapter)
 	retrc = plpar_hcall_norets(H_REG_CRQ,
 				   vdev->unit_address,
 				   queue->msg_token, PAGE_SIZE);
-	retrc = rc;
+	rc = retrc;
 
 	if (rc == H_RESOURCE)
 		rc = ibmvmc_reset_crq_queue(adapter);
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] misc: ibmvsm: Fix wrong assignment of return code
  2018-08-06 13:31 [PATCH] misc: ibmvsm: Fix wrong assignment of return code Bryant G. Ly
@ 2018-08-07 12:28 ` Michael Ellerman
  2018-08-07 14:22   ` Bryant G. Ly
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2018-08-07 12:28 UTC (permalink / raw)
  To: Bryant G. Ly, gregkh; +Cc: linuxppc-dev, linux-kernel, Bryant G. Ly

"Bryant G. Ly" <bryantly@linux.vnet.ibm.com> writes:

> From: "Bryant G. Ly" <bryantly@linux.ibm.com>
>
> Currently the assignment is flipped and rc is always 0.

If you'd left rc uninitialised at the start of the function the compiler
would have caught it for you.

And what is the consequence of the bug? Nothing, complete system crash,
subtle data corruption?

Also this should be tagged:

Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")

cheers

> diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c
> index 8f82bb9..b8aaa68 100644
> --- a/drivers/misc/ibmvmc.c
> +++ b/drivers/misc/ibmvmc.c
> @@ -2131,7 +2131,7 @@ static int ibmvmc_init_crq_queue(struct crq_server_adapter *adapter)
>  	retrc = plpar_hcall_norets(H_REG_CRQ,
>  				   vdev->unit_address,
>  				   queue->msg_token, PAGE_SIZE);
> -	retrc = rc;
> +	rc = retrc;
>  
>  	if (rc == H_RESOURCE)
>  		rc = ibmvmc_reset_crq_queue(adapter);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] misc: ibmvsm: Fix wrong assignment of return code
  2018-08-07 12:28 ` Michael Ellerman
@ 2018-08-07 14:22   ` Bryant G. Ly
  0 siblings, 0 replies; 3+ messages in thread
From: Bryant G. Ly @ 2018-08-07 14:22 UTC (permalink / raw)
  To: Michael Ellerman, Bryant G. Ly, gregkh; +Cc: linuxppc-dev, linux-kernel


On 8/7/18 7:28 AM, Michael Ellerman wrote:

> "Bryant G. Ly" <bryantly@linux.vnet.ibm.com> writes:
>
>> From: "Bryant G. Ly" <bryantly@linux.ibm.com>
>>
>> Currently the assignment is flipped and rc is always 0.
> If you'd left rc uninitialised at the start of the function the compiler
> would have caught it for you.
>
> And what is the consequence of the bug? Nothing, complete system crash,
> subtle data corruption?

The consequence would be that if the CRQ Registration failed the first time
due to not enough resources, it would never try to reset and try again. 

If it fails due to any other error then it would just fail the sending of the
crq init message, thus it would just wait for the client to init, which would
never happen. 

We would also have a memory leak since in the error case DMA would never get
un-mapped and the message queue never gets freed. 

>
> Also this should be tagged:
>
> Fixes: 0eca353e7ae7 ("misc: IBM Virtual Management Channel Driver (VMC)")
>
> cheers
>
Yep, sorry I forgot to add the Fixes:..

-Bryant

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-07 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-06 13:31 [PATCH] misc: ibmvsm: Fix wrong assignment of return code Bryant G. Ly
2018-08-07 12:28 ` Michael Ellerman
2018-08-07 14:22   ` Bryant G. Ly

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).