25 Jan, 2014

1 commit

  • When CONFIG_SYS_VSNPRINTF is enabled, it protects print operations
    such as sprintf, snprintf, vsnprintf, etc., from buffer overflows.
    But vsnprintf_internal includes the terminating NULL character in
    the calculation of number of characters written. This affects sprintf
    and snprintf return values. Fix this issue by setting pointer 'str'
    back to the location of the '\0'.

    Signed-off-by: Darwin Rambo
    Reviewed-by: Steve Rae

    Darwin Rambo
     

26 Jun, 2013

1 commit


20 Feb, 2013

1 commit


14 Dec, 2012

1 commit

  • The ustrtoul shall convert string defined size (e.g. 1GiB) to unsigned
    long type (as its name implies).

    Up till now it had returned int, which might cause problems with large
    numbers (GiB range), when interpreted as U2 signed numbers.

    Signed-off-by: Lukasz Majewski
    Signed-off-by: Kyungmin Park

    Lukasz Majewski
     

05 Nov, 2012

1 commit


03 Nov, 2012

1 commit

  • The %p format of printf() would print a pointer to address null as
    "(null)". This makes sense in a real OS where a NULL pointer must
    never be dereferenced, but this is a bootloader, and there are cases
    where accessing the data at address null makes perfect sense.

    Remove the special case in lib/vsprintf.c using "#if 0" with a comment
    to make clear this was an intentional change and to stop re-adding
    this code.

    Signed-off-by: Wolfgang Denk
    Acked-by: Joe Hershberger

    Wolfgang Denk
     

16 Oct, 2012

2 commits


18 Dec, 2011

2 commits


27 Oct, 2011

1 commit


10 Sep, 2011

1 commit

  • assert() is like BUG_ON() but compiles to nothing unless DEBUG is defined.
    This is useful when a condition is an error but a board reset is unlikely
    to fix it, so it is better to soldier on in hope. Assertion failures should
    be caught during development/test.

    It turns out that assert() is defined separately in a few places in U-Boot
    with various meanings. This patch cleans up some of these.

    Build errors exposed by this change (and defining DEBUG) are also fixed in
    this patch.

    Signed-off-by: Simon Glass

    Simon Glass
     

29 Jul, 2011

1 commit

  • since commit

    commit d2e8b911c0a0661d395ccac72156040702ac842d
    Author: Mike Frysinger
    Date: Wed Jun 29 11:58:04 2011 +0000

    panic: add noreturn attribute

    I see the following warnings:

    vsprintf.c: In function 'panic':
    vsprintf.c:730: warning: 'noreturn' function does return

    for nearly all boards. This patch fixes this warning.

    Signed-off-by: Heiko Schocher
    cc: Mike Frysinger

    Heiko Schocher
     

13 May, 2011

1 commit

  • as checkpatch proposes to use strict_strtoul instead of
    simple_strtoul, introduce it.

    Ported this function from Linux 2.6.38 commit ID:
    521cb40b0c44418a4fd36dc633f575813d59a43d

    Signed-off-by: Heiko Schocher
    cc: Wolfgang Denk
    cc: Detlev Zundel
    cc: Valentin Longchamp
    cc: Holger Brunck
    Signed-off-by: Valentin Longchamp

    Heiko Schocher
     

29 Nov, 2010

1 commit


05 Jul, 2010

1 commit

  • The hush shell dynamically allocates (and re-allocates) memory for the
    argument strings in the "char *argv[]" argument vector passed to
    commands. Any code that modifies these pointers will cause serious
    corruption of the malloc data structures and crash U-Boot, so make
    sure the compiler can check that no such modifications are being done
    by changing the code into "char * const argv[]".

    This modification is the result of debugging a strange crash caused
    after adding a new command, which used the following argument
    processing code which has been working perfectly fine in all Unix
    systems since version 6 - but not so in U-Boot:

    int main (int argc, char **argv)
    {
    while (--argc > 0 && **++argv == '-') {
    /* ====> */ while (*++*argv) {
    switch (**argv) {
    case 'd':
    debug++;
    break;
    ...
    default:
    usage ();
    }
    }
    }
    ...
    }

    The line marked "====>" will corrupt the malloc data structures and
    usually cause U-Boot to crash when the next command gets executed by
    the shell. With the modification, the compiler will prevent this with
    an
    error: increment of read-only location '*argv'

    N.B.: The code above can be trivially rewritten like this:

    while (--argc > 0 && **++argv == '-') {
    char *arg = *argv;
    while (*++arg) {
    switch (*arg) {
    ...

    Signed-off-by: Wolfgang Denk
    Acked-by: Mike Frysinger

    Wolfgang Denk
     

13 Apr, 2010

1 commit

  • Now that the other architecture-specific lib directories have been
    moved out of the top-level directory there's not much reason to have the
    '_generic' suffix on the common lib directory.

    Signed-off-by: Peter Tyser

    Peter Tyser