Skip to contentSkip to conversation

vmcore-dmesg: struct_val_u64() not casting u64 to u32

PATCH In review WANG Chao 3 participants 4 messages Jan 6, 2014 – Jan 13, 2014

Subsystems (2)
lore
Share & tools
lore

WANG Chao

author
#0 lore raw

PATCH 1/1 vmcore-dmesg: struct_val_u64() not casting u64 to u32

It seems gcc doesn't check return type from inline function. struct_val_u64() should return u64 otherwise upper 32bit is lost.

---
 vmcore-dmesg/vmcore-dmesg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vmcore-dmesg/vmcore-dmesg.c +1 -1
index 0f477c0..df14c89 100644
@@ -529,7 +529,7 @@ static inline uint32_t struct_val_u32(char *ptr, unsigned int offset)
 	return(file32_to_cpu(*(uint32_t *)(ptr + offset)));
 }
 
-static inline uint32_t struct_val_u64(char *ptr, unsigned int offset)
+static inline uint64_t struct_val_u64(char *ptr, unsigned int offset)
 {
 	return(file64_to_cpu(*(uint64_t *)(ptr + offset)));
 }
Signature · 7 lines
1.8.4.2


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · WANG Chao

It seems gcc doesn't check return type from inline function. struct_val_u64() should return u64 otherwise upper 32bit is lost.

Vivek

Quoted 25 lines
---
 vmcore-dmesg/vmcore-dmesg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vmcore-dmesg/vmcore-dmesg.c +1 -1
index 0f477c0..df14c89 100644
@@ -529,7 +529,7 @@ static inline uint32_t struct_val_u32(char *ptr, unsigned int offset)
 	return(file32_to_cpu(*(uint32_t *)(ptr + offset)));
 }
 
-static inline uint32_t struct_val_u64(char *ptr, unsigned int offset)
+static inline uint64_t struct_val_u64(char *ptr, unsigned int offset)
 {
 	return(file64_to_cpu(*(uint64_t *)(ptr + offset)));
 }
Signature · 7 lines
1.8.4.2


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

author
#2 lore raw
Quoted 9 lines · Vivek Goyal
Quoted 4 lines · WANG Chao

It seems gcc doesn't check return type from inline function. struct_val_u64() should return u64 otherwise upper 32bit is lost.

Vivek

Hi, Simon

Could you please pick up this one?

Thanks
WANG Chao

Quoted 22 lines
Quoted 22 lines
---
 vmcore-dmesg/vmcore-dmesg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
vmcore-dmesg/vmcore-dmesg.c +1 -1
index 0f477c0..df14c89 100644
@@ -529,7 +529,7 @@ static inline uint32_t struct_val_u32(char *ptr, unsigned int offset)
 	return(file32_to_cpu(*(uint32_t *)(ptr + offset)));
 }
 
-static inline uint32_t struct_val_u64(char *ptr, unsigned int offset)
+static inline uint64_t struct_val_u64(char *ptr, unsigned int offset)
 {
 	return(file64_to_cpu(*(uint64_t *)(ptr + offset)));
 }
Signature · 1 line
1.8.4.2
Quoted 9 lines
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
Quoted 7 lines · WANG Chao
Quoted 6 lines · Vivek Goyal
Quoted 4 lines · WANG Chao

It seems gcc doesn't check return type from inline function. struct_val_u64() should return u64 otherwise upper 32bit is lost.

Quoted 7 lines
Quoted 3 lines

Vivek

Hi, Simon

Could you please pick up this one?

Done, thanks.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec