diff mbox

[U-Boot,2/2] itest: add missing break statements to evalexp()

Message ID 1447781348-22007-2-git-send-email-swarren@wwwdotorg.org
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren Nov. 17, 2015, 5:29 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

The commit mentioned below replaced return statements inside a switch so
that other code could be called after the switch. However, it didn't add
any break statements, causing the cases to run together. Fix this.

Reported-by: Coverity (CID 132282, 132283)
Fixes: 7861204c9af7 ("itest: make memory access work under sandbox")
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 common/cmd_itest.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Tom Rini Nov. 18, 2015, 10:37 p.m. UTC | #1
On Tue, Nov 17, 2015 at 10:29:08AM -0700, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>
> 
> The commit mentioned below replaced return statements inside a switch so
> that other code could be called after the switch. However, it didn't add
> any break statements, causing the cases to run together. Fix this.
> 
> Reported-by: Coverity (CID 132282, 132283)
> Fixes: 7861204c9af7 ("itest: make memory access work under sandbox")
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index 596341c9635a..91ae5c2704c8 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -64,9 +64,15 @@  static long evalexp(char *s, int w)
 			return 0;
 		}
 		switch (w) {
-		case 1: l = (long)(*(unsigned char *)buf);
-		case 2: l = (long)(*(unsigned short *)buf);
-		case 4: l = (long)(*(unsigned long *)buf);
+		case 1:
+			l = (long)(*(unsigned char *)buf);
+			break;
+		case 2:
+			l = (long)(*(unsigned short *)buf);
+			break;
+		case 4:
+			l = (long)(*(unsigned long *)buf);
+			break;
 		}
 		unmap_physmem(buf, w);
 		return l;