mtdparts add not working
PATCH 1/1 mtdparts add not working
Adding a new partition using the mtdparts command causes a null pointer access because the device_parse function does not accept a null pointer as parameter.
Signed-off-by Stefano Babic <[email protected]>
--- common/cmd_mtdparts.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
common/cmd_mtdparts.c +3 -1
@@ -1795,6 +1795,7 @@ int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])struct mtd_device *dev_tmp;struct mtdids *id;struct part_info *p; +const char dummy, *pdummy;if (mtd_id_parse (argv[2 ],NULL , &type, &num) !=0 )return 1 ;
@@ -1818,7 +1819,8 @@ int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) id->mtd_id, argv[3], argv[4], argv[5] ? argv[5] : "");DEBUGF ("add tmpbuf: %s\n" , tmpbuf); -if ((device_parse (tmpbuf,NULL , &dev) !=0 ) || (!dev)) + pdummy = &dummy; +if ((device_parse (tmpbuf, &pdummy, &dev) !=0 ) || (!dev))return 1 ; DEBUGF("+ %s\t%d\t%s\n", MTD_DEV_TYPE(dev->id->type),
Signature · 1 line
1.6.3.3