linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] IB/core: fix incorrect fall-through on switch statement
@ 2017-09-11 16:03 Colin King
  2017-09-13 16:49 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-09-11 16:03 UTC (permalink / raw)
  To: Doug Ledford, Sean Hefty, Hal Rosenstock, Leon Romanovsky, linux-rdma
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

In the case where mbox_status is OCRDMA_MBX_STATUS_FAILED and
add_status is OCRDMA_MBX_STATUS_FAILED err_num is assigned -EAGAIN
however the case OCRDMA_MBX_STATUS_FAILED is missing a break and
falls through to the default case which then re-assigns err_num
to -EFAULT.   Fix this so that err_num is assigned to -EAGAIN
for the add_status OCRDMA_MBX_STATUS_FAILED case and -EFAULT
otherwise.

Detected by CoverityScan CID#703125 ("Missing break in switch")

Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index dcb5942f9fb5..65b166cc7437 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -252,7 +252,10 @@ static int ocrdma_get_mbx_errno(u32 status)
 		case OCRDMA_MBX_ADDI_STATUS_INSUFFICIENT_RESOURCES:
 			err_num = -EAGAIN;
 			break;
+		default:
+			err_num = -EFAULT;
 		}
+		break;
 	default:
 		err_num = -EFAULT;
 	}
-- 
2.14.1

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

* Re: [PATCH] IB/core: fix incorrect fall-through on switch statement
  2017-09-11 16:03 [PATCH] IB/core: fix incorrect fall-through on switch statement Colin King
@ 2017-09-13 16:49 ` Leon Romanovsky
  2017-09-22 17:16   ` Doug Ledford
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2017-09-13 16:49 UTC (permalink / raw)
  To: Colin King
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, linux-rdma,
	kernel-janitors, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 937 bytes --]

On Mon, Sep 11, 2017 at 05:03:13PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> In the case where mbox_status is OCRDMA_MBX_STATUS_FAILED and
> add_status is OCRDMA_MBX_STATUS_FAILED err_num is assigned -EAGAIN
> however the case OCRDMA_MBX_STATUS_FAILED is missing a break and
> falls through to the default case which then re-assigns err_num
> to -EFAULT.   Fix this so that err_num is assigned to -EAGAIN
> for the add_status OCRDMA_MBX_STATUS_FAILED case and -EFAULT
> otherwise.
>
> Detected by CoverityScan CID#703125 ("Missing break in switch")
>
> Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 3 +++
>  1 file changed, 3 insertions(+)
>

Except the wrong title: IB/core -> IB/ocrdma

Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Thanks

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] IB/core: fix incorrect fall-through on switch statement
  2017-09-13 16:49 ` Leon Romanovsky
@ 2017-09-22 17:16   ` Doug Ledford
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2017-09-22 17:16 UTC (permalink / raw)
  To: Leon Romanovsky, Colin King
  Cc: Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors, linux-kernel

On Wed, 2017-09-13 at 19:49 +0300, Leon Romanovsky wrote:
> On Mon, Sep 11, 2017 at 05:03:13PM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > In the case where mbox_status is OCRDMA_MBX_STATUS_FAILED and
> > add_status is OCRDMA_MBX_STATUS_FAILED err_num is assigned -EAGAIN
> > however the case OCRDMA_MBX_STATUS_FAILED is missing a break and
> > falls through to the default case which then re-assigns err_num
> > to -EFAULT.   Fix this so that err_num is assigned to -EAGAIN
> > for the add_status OCRDMA_MBX_STATUS_FAILED case and -EFAULT
> > otherwise.
> > 
> > Detected by CoverityScan CID#703125 ("Missing break in switch")
> > 
> > Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect
> > IBoE RDMA adapter")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> 
> Except the wrong title: IB/core -> IB/ocrdma
> 
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

Thanks, patch (with fixed subject) applied.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

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

end of thread, other threads:[~2017-09-22 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 16:03 [PATCH] IB/core: fix incorrect fall-through on switch statement Colin King
2017-09-13 16:49 ` Leon Romanovsky
2017-09-22 17:16   ` Doug Ledford

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