Thread (4 messages) 4 messages, 4 authors, 2010-11-16

Re: Corrected data type mismatch

From: bhs <hidden>
Date: 2010-11-16 13:16:50
Also in: lkml

On Nov 16, 2010, at 8:07 PM, DDD wrote:
Milton Miller wrote:
quoted
[added cc's based on from ff10b88b5a05c8f1646dd15fb9f6093c1384ff6d,
which added the patched line ]
https://patchwork.kernel.org/patch/323022/
On Sun, 14 Nov 2010 around 02:06:59 -0000, Hai Shan wrote:
quoted
Corrected data type mismatch
=20
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
quoted
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.
=20
=20
OOPS! It is wrong here, The right one should be as following:
=20
-   memcpy(mem, current->thread.evr[regno-32],
+   memcpy(mem, (void*)&current->thread.evr[regno-32], =
dbg_reg_def[regno].size);
=20
Thanks milton & Shan.Hai, I will send out the fix to Jason ASAP.
=20

Sorry for my crude fix :)

Dongdong
=20
=20
quoted
milton
quoted
Signed-off-by: Hai Shan <redacted>
=20
---
arch/powerpc/kernel/kgdb.c |    4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
=20
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 7a9db64..c5ce65f 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -337,7 +337,7 @@ char *dbg_get_reg(int regno, void *mem, struct =
pt_regs *regs)
quoted
quoted
		/* 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],
quoted
quoted
					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
quoted
	if (regno >=3D 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 */
=20
--
To unsubscribe from this list: send the line "unsubscribe =
linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help