diff mbox

[U-Boot] Hanging in kmalloc of nand_scan_tail() function

Message ID 9E4225D4-6015-472E-AAEA-3ACEE4198476@kernel.crashing.org
State RFC
Headers show

Commit Message

Kumar Gala Nov. 13, 2010, 4:24 p.m. UTC
On Nov 12, 2010, at 9:43 PM, terry wrote:

>>> 
>>> by the way,I cann't find the prototype of malloc in the whole project,it
>>> seems that it is encapsulated in some libs.
>> 
>> It's in common/malloc.c.  There's weird preprocessor renaming going on,
>> so it's called mALLOc in that file, but it shows up as malloc in the
>> binary.
> Thanks very much for your carefully instruction.
> 
>> 
>> -Scott
>> 
> 

I haven't been following this thread, but just debugging a malloc/nand "corruption" issue myself.  I'm going to start a new thread on the subject since its more related to malloc.  However can you try the following and see what happens:

Comments

terry Nov. 14, 2010, 1:18 p.m. UTC | #1
在 2010-11-13六的 10:24 -0600,Kumar Gala写道:
> On Nov 12, 2010, at 9:43 PM, terry wrote:
> 
> >>> 
> >>> by the way,I cann't find the prototype of malloc in the whole project,it
> >>> seems that it is encapsulated in some libs.
> >> 
> >> It's in common/malloc.c.  There's weird preprocessor renaming going on,
> >> so it's called mALLOc in that file, but it shows up as malloc in the
> >> binary.
> > Thanks very much for your carefully instruction.
> > 
> >> 
> >> -Scott
> >> 
> > 
> 
> I haven't been following this thread, but just debugging a malloc/nand "corruption" issue myself.  I'm going to start a new thread on the subject since its more related to malloc.  However can you try the following and see what happens:
> 
> diff --git a/include/malloc.h b/include/malloc.h

I'm sorry, but I cann't understand you clearly. what do you mean by
writting this? compare two different versions? if so, which two version?

> index 3e145ad..19f0f0b 100644
> --- a/include/malloc.h
> +++ b/include/malloc.h
> @@ -850,7 +850,7 @@ extern Void_t*     sbrk();
>  #endif
>  
>  #ifndef MORECORE_CLEARS
> -#define MORECORE_CLEARS 1
> +#define MORECORE_CLEARS 0
>  #endif
>  
>  #endif /* INTERNAL_LINUX_C_LIB */
I read the malloc.h file in u-boot-2010.09. it's content like below:
#ifdef INTERNAL_LINUX_C_LIB
819 
820 #if __STD_C
821 
822 Void_t * __default_morecore_init (ptrdiff_t);
823 Void_t *(*__morecore)(ptrdiff_t) = __default_morecore_init;
824 
825 #else
826 
827 Void_t * __default_morecore_init ();
828 Void_t *(*__morecore)() = __default_morecore_init;
829 
830 #endif /* __STD_C */
831 
832 #define MORECORE (*__morecore)
833 #define MORECORE_FAILURE 0
834 #define MORECORE_CLEARS 1

#else /* INTERNAL_LINUX_C_LIB */
837 
838 #if __STD_C
839 extern Void_t*     sbrk(ptrdiff_t);
840 #else
841 extern Void_t*     sbrk();
842 #endif
843 
844 #ifndef MORECORE
845 #define MORECORE sbrk
846 #endif
847 
848 #ifndef MORECORE_FAILURE
849 #define MORECORE_FAILURE -1
850 #endif
851 
852 #ifndef MORECORE_CLEARS
853 #define MORECORE_CLEARS 1
854 #endif
855 
856 #endif /* INTERNAL_LINUX_C_LIB */
Do you mean that I should change MORECORE_CLEARS from 1 to 0?
Kumar Gala Nov. 15, 2010, 3:05 p.m. UTC | #2
On Nov 14, 2010, at 7:18 AM, terry wrote:

> 在 2010-11-13六的 10:24 -0600,Kumar Gala写道:
>> On Nov 12, 2010, at 9:43 PM, terry wrote:
>> 
>>>>> 
>>>>> by the way,I cann't find the prototype of malloc in the whole project,it
>>>>> seems that it is encapsulated in some libs.
>>>> 
>>>> It's in common/malloc.c.  There's weird preprocessor renaming going on,
>>>> so it's called mALLOc in that file, but it shows up as malloc in the
>>>> binary.
>>> Thanks very much for your carefully instruction.
>>> 
>>>> 
>>>> -Scott
>>>> 
>>> 
>> 
>> I haven't been following this thread, but just debugging a malloc/nand "corruption" issue myself.  I'm going to start a new thread on the subject since its more related to malloc.  However can you try the following and see what happens:
>> 
>> diff --git a/include/malloc.h b/include/malloc.h
> 
> I'm sorry, but I cann't understand you clearly. what do you mean by
> writting this? compare two different versions? if so, which two version?
> 
>> index 3e145ad..19f0f0b 100644
>> --- a/include/malloc.h
>> +++ b/include/malloc.h
>> @@ -850,7 +850,7 @@ extern Void_t*     sbrk();
>> #endif
>> 
>> #ifndef MORECORE_CLEARS
>> -#define MORECORE_CLEARS 1
>> +#define MORECORE_CLEARS 0
>> #endif
>> 
>> #endif /* INTERNAL_LINUX_C_LIB */
> I read the malloc.h file in u-boot-2010.09. it's content like below:
> #ifdef INTERNAL_LINUX_C_LIB
> 819 
> 820 #if __STD_C
> 821 
> 822 Void_t * __default_morecore_init (ptrdiff_t);
> 823 Void_t *(*__morecore)(ptrdiff_t) = __default_morecore_init;
> 824 
> 825 #else
> 826 
> 827 Void_t * __default_morecore_init ();
> 828 Void_t *(*__morecore)() = __default_morecore_init;
> 829 
> 830 #endif /* __STD_C */
> 831 
> 832 #define MORECORE (*__morecore)
> 833 #define MORECORE_FAILURE 0
> 834 #define MORECORE_CLEARS 1
> 
> #else /* INTERNAL_LINUX_C_LIB */
> 837 
> 838 #if __STD_C
> 839 extern Void_t*     sbrk(ptrdiff_t);
> 840 #else
> 841 extern Void_t*     sbrk();
> 842 #endif
> 843 
> 844 #ifndef MORECORE
> 845 #define MORECORE sbrk
> 846 #endif
> 847 
> 848 #ifndef MORECORE_FAILURE
> 849 #define MORECORE_FAILURE -1
> 850 #endif
> 851 
> 852 #ifndef MORECORE_CLEARS
> 853 #define MORECORE_CLEARS 1
> 854 #endif
> 855 
> 856 #endif /* INTERNAL_LINUX_C_LIB */
> Do you mean that I should change MORECORE_CLEARS from 1 to 0?

Yes, I was asking you to modify include/malloc.h to change MORECORE_CLEARS from 1 to 0 and see if that helps your issue.  You need to modify the one on lines 853.

- k
diff mbox

Patch

diff --git a/include/malloc.h b/include/malloc.h
index 3e145ad..19f0f0b 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -850,7 +850,7 @@  extern Void_t*     sbrk();
 #endif
 
 #ifndef MORECORE_CLEARS
-#define MORECORE_CLEARS 1
+#define MORECORE_CLEARS 0
 #endif
 
 #endif /* INTERNAL_LINUX_C_LIB */