Bug 60845

Summary: [TRIVIAL]arch/mips/pci/msi-octeon.c: 155: possible missing break ?
Product: Platform Specific/Hardware Reporter: David Binderman (dcb314)
Component: MIPSAssignee: ralf
Status: RESOLVED CODE_FIX    
Severity: normal CC: alan, herrmann.der.user, xerofoify
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.12 Subsystem:
Regression: No Bisected commit-id:

Description David Binderman 2013-09-04 07:32:25 UTC
Source code is

    case OCTEON_DMA_BAR_TYPE_SMALL:
        /* When not using big bar, Bar 0 is based at 128MB */
        msg.address_lo =
            ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff;
        msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32;
    case OCTEON_DMA_BAR_TYPE_BIG:
        /* When using big bar, Bar 0 is based at 0 */
        msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff;
        msg.address_hi = (0 + CVMX_PCI_MSI_RCV) >> 32;
        break;

Possible unintended fallthrough. Suggest add break.
Bug found by cppcheck, a static analysis tool.
Comment 1 xerofoify 2014-02-25 22:08:43 UTC
 case OCTEON_DMA_BAR_TYPE_SMALL:
        /* When not using big bar, Bar 0 is based at 128MB */
        msg.address_lo =
            ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff;
        msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32;
//adding break 

    case OCTEON_DMA_BAR_TYPE_BIG:
        /* When using big bar, Bar 0 is based at 0 */
        msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff;
        msg.address_hi = (0 + CVMX_PCI_MSI_RCV) >> 32;
        break;
Comment 2 xerofoify 2014-02-25 22:09:04 UTC
(In reply to nickkrause from comment #1)
>  case OCTEON_DMA_BAR_TYPE_SMALL:
>         /* When not using big bar, Bar 0 is based at 128MB */
>         msg.address_lo =
>             ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff;
>         msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32;
> //adding break 
       break;
> 
>     case OCTEON_DMA_BAR_TYPE_BIG:
>         /* When using big bar, Bar 0 is based at 0 */
>         msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff;
>         msg.address_hi = (0 + CVMX_PCI_MSI_RCV) >> 32;
>         break;
Comment 3 xerofoify 2014-02-27 04:29:56 UTC
Is there any one reading or tracing bug as I have fixed it.
Comment 4 Alan 2014-02-27 14:36:56 UTC
No changes or commits have been made to that file since 2011.
Comment 5 xerofoify 2014-02-27 15:07:46 UTC
Then close the bug or add my break.
Nick

----------------------------------------
> From: bugzilla-daemon@bugzilla.kernel.org
> To: nickkrause@sympatico.ca
> Subject: [Bug 60845] [TRIVIAL]arch/mips/pci/msi-octeon.c: 155: possible
> missing break ?
> Date: Thu, 27 Feb 2014 14:36:56 +0000
>
> https://bugzilla.kernel.org/show_bug.cgi?id=60845
>
> --- Comment #4 from Alan <alan@lxorguk.ukuu.org.uk> ---
> No changes or commits have been made to that file since 2011.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 6 Alan 2014-02-27 21:33:01 UTC
That's not how it works
Comment 7 xerofoify 2014-02-27 23:57:41 UTC
Then Close the bug or otherwise find another solution without a break fallout through 
and even then why wouldn't  you want a break there two different cases completely.

Nick
----------------------------------------
> From: bugzilla-daemon@bugzilla.kernel.org
> To: nickkrause@sympatico.ca
> Subject: [Bug 60845] [TRIVIAL]arch/mips/pci/msi-octeon.c: 155: possible
> missing break ?
> Date: Thu, 27 Feb 2014 21:33:01 +0000
>
> https://bugzilla.kernel.org/show_bug.cgi?id=60845
>
> --- Comment #6 from Alan <alan@lxorguk.ukuu.org.uk> ---
> That's not how it works
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 8 xerofoify 2014-03-05 22:45:02 UTC
What would you like to do to close this bug it is still open even through I send it code, would you like me to send it in a patch overwise it's fixed, close it.
Comment 9 Alan 2014-03-05 23:32:30 UTC
If you submit it as per Documentation/SubmittingPatches I'm sure it'll get added
Comment 10 xerofoify 2014-03-06 04:01:34 UTC
--- //home/nick/linux-3.13.5/arch/mips/pci/msi-octeon.c.orig	2014-03-05 22:48:19.084372515 -0500
+++ //home/nick/linux-3.13.5/arch/mips/pci/msi-octeon.c	2014-03-05 22:48:48.388372344 -0500
@@ -150,6 +150,7 @@ msi_irq_allocated:
 		msg.address_lo =
 			((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff;
 		msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32;
+		break;
 	case OCTEON_DMA_BAR_TYPE_BIG:
 		/* When using big bar, Bar 0 is based at 0 */
 		msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff;
Patch for fixing if you didn't get my email , took an hour to get used to the way you guys patch but now that I known it's easy and is good if I help out again.
Comment 11 xerofoify 2014-03-22 03:58:19 UTC
Can someone please explain why this bug is still open after I haved resent my patch 4 times is it wrong as I didn't sign it off correctly , otherwise add the patch, as I am getting annoyed with the lack of support for bug fixing.
Comment 12 Alan 2014-03-22 16:38:21 UTC
I've only seen one sending of it, followed by a request for it to have the correct Signed-off-by and no response ?
Comment 13 xerofoify 2014-03-22 21:14:52 UTC
Thanks Alan I will resend after adding the Signed-off-by line to you and the other people needed.
Comment 14 xerofoify 2014-03-24 12:13:10 UTC
I didn't get a reply by email if the patch was added and seems like it wasn't as the bug is still open. Do I need to resend the patch or did you get it and haven't closed the bug yet.
Comment 15 herrmann.der.user 2014-03-25 16:40:24 UTC
I think this bug is already fixed with commit

 commit 7f02c463057fc527f52066742b84d9d89b22e83d
 Author: Colin Ian King <colin.king@canonical.com>
 Date:   Mon Feb 10 18:42:57 2014 +0000

    MIPS: Octeon: Fix fall through on bar type OCTEON_DMA_BAR_TYPE_SMALL
    

This patch was introduced with v3.14-rc8
Comment 16 xerofoify 2014-03-25 22:05:26 UTC
Then wouldn't this bug we closed or does it need to be verified first.