Skip to contentSkip to conversation

Corrected data type mismatch in kgdb Powerpc

PATCH In review Hai Shan 4 participants 6 messages Nov 14, 2010 – Nov 16, 2010 PowerPC

lore
Share & tools
lore

Hai Shan

author
#0 lore raw

Corrected data type mismatch in kgdb Powerpc

author
#1 lore raw

PATCH 1/1 Corrected data type mismatch

Corrected data type mismatch

---
 arch/powerpc/kernel/kgdb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/kgdb.c +2 -2
index 7a9db64..c5ce65f 100644
@@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
 		if (current)
-			memcpy(mem, current->thread.evr[regno-32],
+			memcpy(mem, (void *)current->thread.evr[regno-32],
 					dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
@@ -362,7 +362,7 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
 	if (regno >= 32 && regno < 64) {
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
-		memcpy(current->thread.evr[regno-32], mem,
+		memcpy((void *)current->thread.evr[regno-32], mem,
 				dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
Signature · 1 line
1.7.0.4
#2 lore raw

Re: Corrected data type mismatch

[added cc's based on from ff10b88b5a05c8f1646dd15fb9f6093c1384ff6d, which added the patched line ]

https://patchwork.kernel.org/patch/323022/

Quoted 3 lines · Hai Shan

Corrected data type mismatch

This merely hides the type mismatch by force casting it.

Looking at the context I believe the intent is to copy the the value to or from the register content slot, not take the previous value of the register and use that as an address to copy to or from.

milton

Quoted 28 lines

---
arch/powerpc/kernel/kgdb.c | 4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/kgdb.c +2 -2
index 7a9db64..c5ce65f 100644
@@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
 		if (current)
-			memcpy(mem, current->thread.evr[regno-32],
+			memcpy(mem, (void *)current->thread.evr[regno-32],
 					dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
@@ -362,7 +362,7 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
 	if (regno >= 32 && regno < 64) {
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
-		memcpy(current->thread.evr[regno-32], mem,
+		memcpy((void *)current->thread.evr[regno-32], mem,
 				dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
#3 lore raw

Re: Corrected data type mismatch

Quoted 5 lines · Milton Miller

[added cc's based on from ff10b88b5a05c8f1646dd15fb9f6093c1384ff6d, which added the patched line ]

https://patchwork.kernel.org/patch/323022/

Quoted 8 lines
Quoted 2 lines · Hai Shan

Corrected data type mismatch

This merely hides the type mismatch by force casting it.

Looking at the context I believe the intent is to copy the the value to or from the register content slot, not take the previous value of the register and use that as an address to copy to or from.

OOPS! It is wrong here, The right one should be as following:

- memcpy(mem, current->thread.evr[regno-32],
+ memcpy(mem, (void*)&current->thread.evr[regno-32], dbg_reg_def[regno].size);

Thanks milton & Shan.Hai, I will send out the fix to Jason ASAP.

Dongdong

Quoted 31 lines

milton

Quoted 28 lines

---
arch/powerpc/kernel/kgdb.c | 4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/kgdb.c +2 -2
index 7a9db64..c5ce65f 100644
@@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
 		if (current)
-			memcpy(mem, current->thread.evr[regno-32],
+			memcpy(mem, (void *)current->thread.evr[regno-32],
 					dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
@@ -362,7 +362,7 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
 	if (regno >= 32 && regno < 64) {
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
-		memcpy(current->thread.evr[regno-32], mem,
+		memcpy((void *)current->thread.evr[regno-32], mem,
 				dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
author
#4 lore raw

Re: Corrected data type mismatch

Quoted 18 lines · DDD
Quoted 10 lines · Milton Miller

[added cc's based on from ff10b88b5a05c8f1646dd15fb9f6093c1384ff6d, which added the patched line ]
https://patchwork.kernel.org/patch/323022/

Quoted 2 lines · Hai Shan

Corrected data type mismatch

This merely hides the type mismatch by force casting it. Looking at the context I believe the intent is to copy the the value to or from the register content slot, not take the previous value of the register and use that as an address to copy to or from.

OOPS! It is wrong here, The right one should be as following:

(quoted diff) +1 -1
-   memcpy(mem, current->thread.evr[regno-32],
+   memcpy(mem, (void*)&current->thread.evr[regno-32], dbg_reg_def[regno].size);
Quoted 2 lines

Thanks milton & Shan.Hai, I will send out the fix to Jason ASAP.

Sorry for my crude fix :)

Quoted 38 lines

Dongdong

Quoted 21 lines

milton

Quoted 20 lines

---
arch/powerpc/kernel/kgdb.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/kgdb.c +1 -1
index 7a9db64..c5ce65f 100644
@@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
 		if (current)
-			memcpy(mem, current->thread.evr[regno-32],
+			memcpy(mem, (void *)current->thread.evr[regno-32],
 					dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */
@@ -362,7 +362,7 @@ int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
Quoted 8 lines

arch/powerpc/kernel/kgdb.c int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) · line 368

Quoted 8 lines
arch/powerpc/kernel/kgdb.c +1 -1
 	if (regno >= 32 && regno < 64) {
 		/* FP registers 32 -> 63 */
 #if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
-		memcpy(current->thread.evr[regno-32], mem,
+		memcpy((void *)current->thread.evr[regno-32], mem,
 				dbg_reg_def[regno].size);
 #else
 		/* fp registers not used by kernel, leave zero */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#5 lore raw

RE: Corrected data type mismatch

=20

Quoted 4 lines

Review

Quoted 4 lines

OOPS! It is wrong here, The right one should be as following:
=20

(quoted diff) +1 -1
-   memcpy(mem, current->thread.evr[regno-32],
+   memcpy(mem, (void*)&current->thread.evr[regno-32],

dbg_reg_def[regno].size);

The (void *) cast should be unnecessary ....

David