提交 736d1746 编写于 作者: S Stephen Warren 提交者: Tom Rini

itest: add missing break statements to evalexp()

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: 7861204c ("itest: make memory access work under sandbox")
Signed-off-by: NStephen Warren <swarren@nvidia.com>
上级 34a60d9b
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册