malloc: Use malloc simple before malloc is fully initialized in memalign()
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Follow implementation in mALLOc(). Check GD_FLG_FULL_MALLOC_INIT flag and use malloc_simple if GD_FLG_FULL_MALLOC_INIT is unset. Adjust the malloc bytes to align with the requested alignment.
The original memalign() function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.
--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
common/dlmalloc.c +7 -0
@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN ) +if (!(gd->flags &GD_FLG_FULL_MALLOC_INIT )) { + nb =roundup (bytes, alignment); +return malloc_simple (nb); + } +#endif +/* If need less alignment than we give anyway, just relay to malloc */ if (alignment <=MALLOC_ALIGNMENT )return mALLOc (bytes);
Signature · 1 line
1.7.1
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Quoted 9 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
In reply to Ley Foon TanHi Ley,
Quoted 18 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0
common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 4 lines
common/dlmalloc.c +1
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )
How about:
if (IS_ENABLED(CONFIG_SYS_MALLOC_F))
?
Quoted 10 lines
common/dlmalloc.c +6
-1+if (!(gd->flags &GD_FLG_FULL_MALLOC_INIT )) { + nb =roundup (bytes, alignment); +return malloc_simple (nb); + } +#endif +/* If need less alignment than we give anyway, just relay to malloc */ if (alignment <=MALLOC_ALIGNMENT )return mALLOc (bytes); --
Quoted 2 lines
1.7.1
Regards,
Simon
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Quoted 22 lines · Simon Glass
Hi Ley,
Quoted 19 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
Quoted 7 lines
common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 3 lines
common/dlmalloc.c +1
-0if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))
I think this is the reason it uses #if CONFIG_VAL(SYS_MALLOC_F_LEN), same for malloc().
"spl: make SPL and normal u-boot stage use independent SYS_MALLOC_F_LEN"
http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
Quoted 11 lines
?
Quoted 8 lines
common/dlmalloc.c +6
-0+if (!(gd->flags &GD_FLG_FULL_MALLOC_INIT )) { + nb =roundup (bytes, alignment); +return malloc_simple (nb); + } +#endif +/* If need less alignment than we give anyway, just relay to malloc */
Quoted 7 lines
Quoted 4 lines
common/dlmalloc.c +0
-1if (alignment <=MALLOC_ALIGNMENT )return mALLOc (bytes); --1.7.1
Regards,
Simon
Regards
Ley Foon
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Hi,
Quoted 29 lines · Ley Foon Tan
Quoted 28 lines · Simon Glass
Hi Ley,
Quoted 18 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 4 lines
common/dlmalloc.c +1
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
Quoted 8 lines
Quoted 1 line
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))I think this is the reason it uses #if
CONFIG_VAL(SYS_MALLOC_F_LEN), same formalloc()."spl: make SPL and normal u-boot stage use independent
SYS_MALLOC_F_LEN"http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
So how about
if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)
Or you could use #if if you need to
To me it seems better to use the setting itself (i.e. whether the pre-reloc malloc() is enabled) rather than one of its parameters (the size of the region).
Quoted 13 lines
Quoted 13 lines
?
Quoted 8 lines
common/dlmalloc.c +6
-0+if (!(gd->flags &GD_FLG_FULL_MALLOC_INIT )) { + nb =roundup (bytes, alignment); +return malloc_simple (nb); + } +#endif +/* If need less alignment than we give anyway, just relay to malloc */
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
common/dlmalloc.c +0
-1if (alignment <=MALLOC_ALIGNMENT )return mALLOc (bytes); --1.7.1
Regards,
Simon
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Quoted 39 lines · Simon Glass
Hi,
Quoted 36 lines · Ley Foon Tan
Quoted 22 lines · Simon Glass
Hi Ley,
Quoted 19 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;Quoted 7 lines
common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 3 lines
common/dlmalloc.c +1
-0if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))I think this is the reason it uses #if
CONFIG_VAL(SYS_MALLOC_F_LEN), same formalloc()."spl: make SPL and normal u-boot stage use independent
SYS_MALLOC_F_LEN"
Quoted 7 lines
So how about
if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)Or you could use #if if you need to
Tested both #if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.
It will not go into this code.
Quoted 18 lines
To me it seems better to use the setting itself (i.e. whether the pre-reloc
malloc()is enabled) rather than one of its parameters (the size of the region).Quoted 13 lines
Quoted 13 lines
?
Quoted 8 lines
common/dlmalloc.c +6
-0+if (!(gd->flags &GD_FLG_FULL_MALLOC_INIT )) { + nb =roundup (bytes, alignment); +return malloc_simple (nb); + } +#endif +/* If need less alignment than we give anyway, just relay to malloc */
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
common/dlmalloc.c +0
-1if (alignment <=MALLOC_ALIGNMENT )return mALLOc (bytes); --1.7.1
Regards,
Simon
Regards
Ley Foon
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Hi,
Quoted 43 lines · Ley Foon Tan
Quoted 41 lines · Simon Glass
Hi,
Quoted 37 lines · Ley Foon Tan
Quoted 22 lines · Simon Glass
Hi Ley,
Quoted 19 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;Quoted 7 lines
common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 3 lines
common/dlmalloc.c +1
-0if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))I think this is the reason it uses #if
CONFIG_VAL(SYS_MALLOC_F_LEN), same formalloc()."spl: make SPL and normal u-boot stage use independent
SYS_MALLOC_F_LEN"http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
Quoted 8 lines
Quoted 5 lines
So how about
if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)Or you could use #if if you need to
Tested both #if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.
Sorry I mean
CONFIG_IS_ENABLED(SYS_MALLOC_F)
That tells you whether the feature is enabled in U-Boot or SPL.
Quoted 8 lines
It will not go into this code.
Quoted 4 lines
To me it seems better to use the setting itself (i.e. whether the pre-reloc
malloc()is enabled) rather than one of its parameters (the size of the region).
[..]
Regards,
Simon
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Quoted 52 lines · Simon Glass
Hi,
Quoted 49 lines · Ley Foon Tan
Quoted 46 lines · Simon Glass
Hi,
Quoted 29 lines · Ley Foon Tan
Quoted 28 lines · Simon Glass
Hi Ley,
Quoted 18 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 4 lines
common/dlmalloc.c +1
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
Quoted 8 lines
Quoted 1 line
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))I think this is the reason it uses #if
CONFIG_VAL(SYS_MALLOC_F_LEN), same formalloc()."spl: make SPL and normal u-boot stage use independent
SYS_MALLOC_F_LEN"http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
So how about
if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)Or you could use #if if you need to
Quoted 8 lines
Quoted 2 lines
Tested both #if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.Sorry I mean
CONFIG_IS_ENABLED(SYS_MALLOC_F)That tells you whether the feature is enabled in U-Boot or SPL.
#if CONFIG_IS_ENABLED(SYS_MALLOC_F) if not working in SPL build. CONFIG_IS_ENABLED() expects config with "y" or "m", but SPL config is with "1".
Need to use #ifdef CONFIG_SYS_MALLOC_F. Do you want to change to this?
Regards
Ley Foon
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
+Masahiro
Quoted 59 lines · Ley Foon Tan
Quoted 57 lines · Simon Glass
Hi,
Quoted 43 lines · Ley Foon Tan
Quoted 41 lines · Simon Glass
Hi,
Quoted 37 lines · Ley Foon Tan
Quoted 22 lines · Simon Glass
Hi Ley,
Quoted 19 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;Quoted 7 lines
common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 3 lines
common/dlmalloc.c +1
-0if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))I think this is the reason it uses #if
CONFIG_VAL(SYS_MALLOC_F_LEN), same formalloc()."spl: make SPL and normal u-boot stage use independent
SYS_MALLOC_F_LEN"http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
Quoted 8 lines
Quoted 5 lines
So how about
if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)Or you could use #if if you need to
Tested both #if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.Sorry I mean
Quoted 7 lines
Quoted 3 lines
CONFIG_IS_ENABLED(SYS_MALLOC_F)That tells you whether the feature is enabled in U-Boot or SPL.
#if
CONFIG_IS_ENABLED(SYS_MALLOC_F)if not working in SPL build.CONFIG_IS_ENABLED()expects config with "y" or "m", but SPL config is with "1".
That seems very strange, since it defeats the purpose of the macro.
Masahiro, do you know what going on here?
Quoted 1 line
Need to use #ifdef
CONFIG_SYS_MALLOC_F. Do you want to change to this?
Regards,
Simon
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
2018-05-26 11:06 GMT+09:00 Simon Glass <[email protected]>:
Quoted 66 lines
+Masahiro
Quoted 63 lines · Ley Foon Tan
Quoted 60 lines · Simon Glass
Hi,
Quoted 43 lines · Ley Foon Tan
Quoted 41 lines · Simon Glass
Hi,
Quoted 37 lines · Ley Foon Tan
Quoted 22 lines · Simon Glass
Hi Ley,
Quoted 19 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;Quoted 7 lines
common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 3 lines
common/dlmalloc.c +1
-0if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))I think this is the reason it uses #if
CONFIG_VAL(SYS_MALLOC_F_LEN), same formalloc()."spl: make SPL and normal u-boot stage use independent
SYS_MALLOC_F_LEN"http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
Quoted 8 lines
Quoted 5 lines
So how about
if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)Or you could use #if if you need to
Tested both #if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.Sorry I mean
CONFIG_IS_ENABLED(SYS_MALLOC_F)That tells you whether the feature is enabled in U-Boot or SPL.
Quoted 7 lines
Quoted 3 lines
#if
CONFIG_IS_ENABLED(SYS_MALLOC_F)if not working in SPL build.CONFIG_IS_ENABLED()expects config with "y" or "m", but SPL config is with "1".That seems very strange, since it defeats the purpose of the macro.
Masahiro, do you know what going on here?
CONFIG_IS_ENABLED(SYS_MALLOC_F) evaluatesSYS_MALLOC_F, or SPL_SYS_MALLOC_F
depending on which image is being built.
I see SPL_SYS_MALLOC_F_LEN in Kconfig,
but do not see SPL_SYS_MALLOC_F at all.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/1 malloc: Use malloc simple before malloc is fully initialized in memalign()
Hi Masahiro,
Quoted 76 lines · Masahiro Yamada
2018-05-26 11:06 GMT+09:00 Simon Glass <[email protected]>:
Quoted 66 lines
+Masahiro
Quoted 63 lines · Ley Foon Tan
Quoted 60 lines · Simon Glass
Hi,
Quoted 43 lines · Ley Foon Tan
Quoted 41 lines · Simon Glass
Hi,
Quoted 37 lines · Ley Foon Tan
Quoted 22 lines · Simon Glass
Hi Ley,
Quoted 19 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>--- common/dlmalloc.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)common/dlmalloc.c +0
-0@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;Quoted 7 lines
common/dlmalloc.c Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; · line 1894
Quoted 3 lines
common/dlmalloc.c +1
-0if ((long )bytes <0 )return NULL ; +#if CONFIG_VAL (SYS_MALLOC_F_LEN )How about:
if (
IS_ENABLED(CONFIG_SYS_MALLOC_F))I think this is the reason it uses #if
CONFIG_VAL(SYS_MALLOC_F_LEN), same formalloc()."spl: make SPL and normal u-boot stage use independent
SYS_MALLOC_F_LEN"http://git.denx.de/?p=u-boot.git;a=commit;h=f1896c45cb2f7d8dbed27e784a6459a129fc0762
Quoted 8 lines
Quoted 5 lines
So how about
if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)Or you could use #if if you need to
Tested both #if (
CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)) and if (CONFIG_IS_ENABLED(SYS_MALLOC_F_LEN)), both are not working.Sorry I mean
CONFIG_IS_ENABLED(SYS_MALLOC_F)That tells you whether the feature is enabled in U-Boot or SPL.
Quoted 7 lines
Quoted 3 lines
#if
CONFIG_IS_ENABLED(SYS_MALLOC_F)if not working in SPL build.CONFIG_IS_ENABLED()expects config with "y" or "m", but SPL config is with "1".That seems very strange, since it defeats the purpose of the macro.
Masahiro, do you know what going on here?
Quoted 7 lines
CONFIG_IS_ENABLED(SYS_MALLOC_F)evaluatesSYS_MALLOC_F, orSPL_SYS_MALLOC_F
depending on which image is being built.I see
SPL_SYS_MALLOC_F_LENinKconfig,
but do not seeSPL_SYS_MALLOC_Fat all.
OK, well that explains the problem, thanks.
Regards,
Simon
Quoted 10 lines · Ley Foon Tan
Follow implementation in
mALLOc(). CheckGD_FLG_FULL_MALLOC_INITflag and usemalloc_simpleifGD_FLG_FULL_MALLOC_INITis unset. Adjust the malloc bytes to align with the requested alignment.The original
memalign()function will access mchunkptr struct to adjust the alignment if there is misalignment happen, but mchunkptr struct is not being initialized before full malloc is initialized. This cause the system crash.Signed-off-by Ley Foon Tan <[email protected]>Reviewed-by Marek Vasut <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180528/46a061ea/attachment.sig>