From 78312fa0c5497b089bb82e55ebe50ac6b8ce4bf9 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Tue, 24 Apr 2012 11:23:03 +0200 Subject: common: memory: fix off-by-one in tlsf_create Signed-off-by: Marc Kleine-Budde Signed-off-by: Sascha Hauer --- common/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/memory.c b/common/memory.c index faff33b419..3b4a5ef4b3 100644 --- a/common/memory.c +++ b/common/memory.c @@ -58,7 +58,7 @@ void mem_malloc_init(void *start, void *end) malloc_end = (unsigned long)end; malloc_brk = malloc_start; #ifdef CONFIG_MALLOC_TLSF - tlsf_mem_pool = tlsf_create(start, (char *)end - (char *)start); + tlsf_mem_pool = tlsf_create(start, end - start + 1); #endif } -- cgit v1.2.3 From 38f9300444edc7ed13af73940a9631bb5d5b881c Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 7 Apr 2012 05:00:14 +0200 Subject: menu: fix double action when "\n\r" or "\r\n" is received Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- common/menu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'common') diff --git a/common/menu.c b/common/menu.c index fd21e52a31..e85a3200ea 100644 --- a/common/menu.c +++ b/common/menu.c @@ -296,7 +296,7 @@ int menu_show(struct menu *m) do { if (m->auto_select >= 0) - ch = KEY_ENTER; + ch = KEY_RETURN; else ch = getc(); @@ -339,7 +339,6 @@ int menu_show(struct menu *m) m->selected->action(m, m->selected); print_menu_entry(m, m->selected, 1); break; - case KEY_ENTER: case KEY_RETURN: clear(); gotoXY(1,1); -- cgit v1.2.3 From eb7667b68167897832de9e8ac0039cc8f6de7b7d Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Mon, 23 Apr 2012 19:12:31 +0800 Subject: menu: fix support for "\n", "\n\r" and "\r" If "\n\r" or "\r\n" is ignore one. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- common/menu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/menu.c b/common/menu.c index e85a3200ea..191bd64cd2 100644 --- a/common/menu.c +++ b/common/menu.c @@ -252,7 +252,7 @@ static void print_menu(struct menu *m) int menu_show(struct menu *m) { - int ch; + int ch, ch_previous = 0; int escape = 0; int countdown; int auto_display_len = 16; @@ -339,7 +339,12 @@ int menu_show(struct menu *m) m->selected->action(m, m->selected); print_menu_entry(m, m->selected, 1); break; + case KEY_ENTER: + if (ch_previous == KEY_RETURN) + break; case KEY_RETURN: + if (ch_previous == KEY_ENTER) + break; clear(); gotoXY(1,1); m->selected->action(m, m->selected); @@ -350,6 +355,7 @@ int menu_show(struct menu *m) default: break; } + ch_previous = ch; } while(1); return 0; -- cgit v1.2.3 From ebde5ae5ac1fa96211b974f444ceed4bc39c3d49 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 1 May 2012 21:38:46 +0200 Subject: hush: bail out of scripts on syntax error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On a systax error we have to bail out of the shell instead of setting inp->p to NULL and crash barebox with a NULL pointer deref. This only happened in scripts. Signed-off-by: Sascha Hauer This fixes the problem I had (i.e. a boot loop caused by a stray fi in /env/bin/init). Reported-by: Uwe Kleine-König Tested-by: Uwe Kleine-König --- common/hush.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/hush.c b/common/hush.c index 053d9a583e..f432c0cae4 100644 --- a/common/hush.c +++ b/common/hush.c @@ -1436,6 +1436,7 @@ static int parse_stream_outer(struct p_context *ctx, struct in_str *inp, int fla rcode = parse_stream(&temp, ctx, inp, '\n'); if (rcode != 1 && ctx->old_flag != 0) { syntax(); + return 1; } if (rcode != 1 && ctx->old_flag == 0) { done_word(&temp, ctx); @@ -1460,8 +1461,9 @@ static int parse_stream_outer(struct p_context *ctx, struct in_str *inp, int fla inp->__promptme = 1; temp.nonnull = 0; temp.quote = 0; - inp->p = NULL; free_pipe_list(ctx->list_head,0); + b_free(&temp); + return 1; } b_free(&temp); } while (rcode != -1 && !(flag & FLAG_EXIT_FROM_LOOP)); /* loop on syntax errors, return on EOF */ -- cgit v1.2.3 From 61eb23d44ebf5aa17f3367d35ae1609bc8497f48 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 1 May 2012 21:39:15 +0200 Subject: uimage/file_to_sdram: fix resource allocation file_to_sdram is used to load an initrd. The resource size is then used to pass the initrd size to Linux. This means that the resource size must exactly match the initrd size. Currently this is not the case since we request the sdram region in chunks of 8 Kbytes. Fix this by adjusting the resource size when the file is loaded. Signed-off-by: Sascha Hauer --- common/uimage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/uimage.c b/common/uimage.c index 4933c40583..945f3d6b0f 100644 --- a/common/uimage.c +++ b/common/uimage.c @@ -404,8 +404,12 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr) res = NULL; goto out; } - if (now < BUFSIZ) + + if (now < BUFSIZ) { + release_sdram_region(res); + res = request_sdram_region("image", adr, ofs + now); goto out; + } release_sdram_region(res); -- cgit v1.2.3 From 7e88b6c7f190e14db9b42987f6172b9cf245a075 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Thu, 3 May 2012 10:01:08 +0200 Subject: complete: fix duplicate env eval list this can be reproductable by this sequence barebox:/ . ? [ addpart bootm cat cd clear cp cpuinfo crc32 delpart devinfo dhcp echo edit erase ethact exit export false getopt go help host loadb loadenv loady login ls md md5sum memcmp memcpy meminfo memset menu mkdir mount mtest mw nfs passwd ping printenv protect pwd readline reset rm rmdir saveenv sedit sh sha1sum sha256sum sleep source test tftp time timeout true umount uncompress unprotect version net.nameserver= net.domainname= cs0.baudrate= cs0.active= cs1.active= cs1.ip= cs1.port= barebox:/ $ $net.nameserver $net.domainname $cs0.baudrate $cs0.active $cs1.active $cs1.ip $cs1.port $net.nameserver $net.domainname $cs0.baudrate $cs0.active $cs1.active $cs1.ip $cs1.port barebox:/ $ Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- common/complete.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/complete.c b/common/complete.c index 0b03d7ce9a..0780888cae 100644 --- a/common/complete.c +++ b/common/complete.c @@ -272,7 +272,7 @@ static char* cmd_complete_lookup(struct string_list *sl, char *instr) { struct command *cmdtp; int len; - int ret = 1; + int ret = COMPLETE_END; char *res = NULL; for_each_command(cmdtp) { -- cgit v1.2.3