linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Corrected data type mismatch in kgdb Powerpc
@ 2010-11-14  2:06 Hai Shan
  2010-11-14  2:06 ` [PATCH] Corrected data type mismatch Hai Shan
  0 siblings, 1 reply; 5+ messages in thread
From: Hai Shan @ 2010-11-14  2:06 UTC (permalink / raw)
  To: linux-kernel


Corrected data type mismatch in kgdb Powerpc

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Corrected data type mismatch
  2010-11-14  2:06 Corrected data type mismatch in kgdb Powerpc Hai Shan
@ 2010-11-14  2:06 ` Hai Shan
  2010-11-16 10:17   ` Milton Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Hai Shan @ 2010-11-14  2:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: Hai Shan

Corrected data type mismatch

Signed-off-by: Hai Shan <shan.hai@windriver.com>
---
 arch/powerpc/kernel/kgdb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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)
 		/* 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 */
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Corrected data type mismatch
  2010-11-14  2:06 ` [PATCH] Corrected data type mismatch Hai Shan
@ 2010-11-16 10:17   ` Milton Miller
  2010-11-16 12:07     ` DDD
  0 siblings, 1 reply; 5+ messages in thread
From: Milton Miller @ 2010-11-16 10:17 UTC (permalink / raw)
  To: Hai Shan
  Cc: linux-kernel, linuxppc-dev, Dongdong Deng, Jason Wessel, kgdb-bugreport

[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:
> 
> 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
> Signed-off-by: Hai Shan <shan.hai@windriver.com>
> 
> ---
> arch/powerpc/kernel/kgdb.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> 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)
>  		/* 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 */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrected data type mismatch
  2010-11-16 10:17   ` Milton Miller
@ 2010-11-16 12:07     ` DDD
  2010-11-16 13:16       ` bhs
  0 siblings, 1 reply; 5+ messages in thread
From: DDD @ 2010-11-16 12:07 UTC (permalink / raw)
  To: Milton Miller
  Cc: Hai Shan, linux-kernel, linuxppc-dev, Jason Wessel, kgdb-bugreport

Milton Miller wrote:
> [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:
>> 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


> 
> milton
>> Signed-off-by: Hai Shan <shan.hai@windriver.com>
>>
>> ---
>> arch/powerpc/kernel/kgdb.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> 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)
>>  		/* 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 */
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrected data type mismatch
  2010-11-16 12:07     ` DDD
@ 2010-11-16 13:16       ` bhs
  0 siblings, 0 replies; 5+ messages in thread
From: bhs @ 2010-11-16 13:16 UTC (permalink / raw)
  To: DDD
  Cc: Milton Miller, Hai Shan, linux-kernel, linuxppc-dev,
	Jason Wessel, kgdb-bugreport


On Nov 16, 2010, at 8:07 PM, DDD wrote:

> Milton Miller wrote:
>> [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:
>>> 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.
> 


Sorry for my crude fix :)


> Dongdong
> 
> 
>> milton
>>> Signed-off-by: Hai Shan <shan.hai@windriver.com>
>>> 
>>> ---
>>> arch/powerpc/kernel/kgdb.c |    4 ++--
>>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>> 
>>> 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)
>>> 		/* 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 */
> 
> --
> 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/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-16 13:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-14  2:06 Corrected data type mismatch in kgdb Powerpc Hai Shan
2010-11-14  2:06 ` [PATCH] Corrected data type mismatch Hai Shan
2010-11-16 10:17   ` Milton Miller
2010-11-16 12:07     ` DDD
2010-11-16 13:16       ` bhs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).