!CFG_MEMTEST_SCRATCH - do not dereference NULL ptr
A message that is not in the archive (sent off-list or not yet received): 20041122100122.GA5418@simek
Quoted 6 lines · In message <20041122100122.GA5418@simek> you wrote:
this is resend of mail from Fri Nov 19 18:49:37. I can't find it in archive.
Index:
common/cmd_mem.c
===================================================================
I hereby reject this patch.
There is no explanation what it does or which problem it is supposed to fix.
There is also no CHANGELOG entry.
Please read the README and resubmit with the required information.
Sorry.
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The following statement is not true. The previous statement is true.
Quoted 2 lines · Wolfgang Denk
There is no explanation what it does or which problem it is supposed to fix.
When CFG_MEMTEST_SCRATCH is undefined alternate memory test in do_mem_mtest (with CFG_ALT_MEMTEST defined) dereferences null pointer. It defines:vu_long *dummy = NULL;
and later does:
*dummy = ~val;
Quoted 1 line
There is also no CHANGELOG entry.
CHANGELOG
* Patch by Ladislav Michl, 22 November 2004
- Fix NULL pointer dereference in alternate memory test (CFG_ALT_MEMTEST) when if no CFG_MEMTEST_SCRATCH area defined
Index: common/cmd_mem.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/common/cmd_mem.c,v retrieving revision 1.19
cmd_mem.c +5 -4
@@ -646,8 +646,9 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, intvu_long num_words;#if defined(CFG_MEMTEST_SCRATCH )vu_long *dummy = (vu_long *)CFG_MEMTEST_SCRATCH ; +#define write_dummy (val) do { *dummy = ~val; } while (0)#else -vu_long *dummy =NULL ; +#define write_dummy (val) do { } while (0)#endif int j;int iterations =1 ;
@@ -723,7 +724,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int val = bitpattern[j];for (; val !=0 ; val <<=1 ) { *addr = val; - *dummy = ~val;/* clear the test data off of the bus */ +write_dummy (~val);/* clear the test data off of the bus */ readback = *addr;if (readback != val) { printf ("FAILURE (data line): "
@@ -731,11 +732,11 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int val, readback); } *addr = ~val; - *dummy = val; +write_dummy (val); readback = *addr;if (readback != ~val) {printf ("FAILURE (data line): " -"Is %08lx, should be %08lx\n" , +"is %08lx, should be %08lx\n" , readback, ~val); } }
Quoted 4 lines · Ladislav Michl
CHANGELOG
* Patch by Ladislav Michl, 22 November 2004
- Fix NULL pointer dereference in alternate memory test (CFG_ALT_MEMTEST) when if noCFG_MEMTEST_SCRATCHarea defined
Wolfgang, any comments on this?
Regards,
ladis
Quoted 7 lines · In message <20041129092025.GB5558@simek> you wrote:
Quoted 4 lines · Ladislav Michl
CHANGELOG
* Patch by Ladislav Michl, 22 November 2004
- Fix NULL pointer dereference in alternate memory test (CFG_ALT_MEMTEST) when if noCFG_MEMTEST_SCRATCHarea definedWolfgang, any comments on this?
Not yet; it's in my queue.
Best regards,
Wolfgang Denk
Signature · 5 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Women professionals do tend to over-compensate. -- Dr. Elizabeth Dehaver, "Where No Man Has Gone Before", stardate 1312.9.