[Skiboot] [PATCH 6/7] llvm-scan-build: fix result of << is undefined

Stewart Smith stewart at linux.vnet.ibm.com
Tue Nov 10 18:44:12 AEDT 2015


hw/fsp/fsp.c:205:13: warning: The result of the '<<' expression is undefined
        return 1ul << (class - FSP_MCLASS_FIRST);
               ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hw/fsp/fsp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
index ab625a55d16d..583476841ad1 100644
--- a/hw/fsp/fsp.c
+++ b/hw/fsp/fsp.c
@@ -198,11 +198,15 @@ static struct fsp *fsp_get_active(void)
 
 static u64 fsp_get_class_bit(u8 class)
 {
+	u8 shift;
+
 	/* Alias classes CE and CF as the FSP has a single queue */
 	if (class == FSP_MCLASS_IPL)
 		class = FSP_MCLASS_SERVICE;
 
-	return 1ul << (class - FSP_MCLASS_FIRST);
+	shift = class - FSP_MCLASS_FIRST;
+	assert(shift < 64);
+	return 1ul << shift;
 }
 
 static struct fsp_cmdclass *__fsp_get_cmdclass(u8 class)
-- 
2.1.4



More information about the Skiboot mailing list