16 Jul, 2019

1 commit

  • mtdparts quit when invalid mtd devices found. Add thes patches to skip
    the invalid devices, so NAND partitions can be alway found to burn boot
    images.

    For instance,

    On i.MX6DL Sabreauto, nand config u-boot didn't enable the weim nor, so
    parsing 8000000.nor leads to error:

    Device nor0 not found!

    With the patches, we can skip this invalid device and still get nand
    boot partition table:

    Device nor0 not found!
    current device is invalid, skip it and check the next one

    device nand0 , # parts = 5
    0: nandboot 0x04000000 0x00000000 0
    1: nandkernel 0x01000000 0x04000000 0
    2: nanddtb 0x01000000 0x05000000 0
    3: nandtee 0x01000000 0x06000000 0
    4: nandrootfs 0xf9000000 0x07000000 0

    active partition: nand0,0 - (nandboot) 0x04000000 @ 0x00000000

    Signed-off-by: Han Xu

    Han Xu
     

20 Sep, 2018

3 commits


24 Jul, 2018

1 commit

  • In the case that there was no name defined for a partition the
    code assumes that name_len is 22 and therefore allocates exactly
    that space for a dummy name. But the function sprintf() first
    resolves "0x%08llx@0x%08llx" to a string that is longer than 22
    bytes. This leads to a buffer overflow. The replacement function
    snprintf() limits the copied bytes to name_len and therefore
    avoids the buffer overflow.

    Signed-off-by: Kay Potthoff

    Kay Potthoff
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

08 Dec, 2017

1 commit

  • The debug() macro now evaluates its expression so does not need #ifdef
    protection. In fact the current code causes a warning with the new log
    implementation. Adjust the code to fix this.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass
     

04 Dec, 2017

1 commit

  • This header was renamed to rawnand.h in Linux.

    The following is the corresponding commit in Linux.

    commit d4092d76a4a4e57b65910899948a83cc8646c5a5
    Author: Boris Brezillon
    Date: Fri Aug 4 17:29:10 2017 +0200

    mtd: nand: Rename nand.h into rawnand.h

    We are planning to share more code between different NAND based
    devices (SPI NAND, OneNAND and raw NANDs), but before doing that
    we need to move the existing include/linux/mtd/nand.h file into
    include/linux/mtd/rawnand.h so we can later create a nand.h header
    containing all common structure and function prototypes.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

27 Aug, 2017

2 commits

  • When reworking this code to fix other issues found by Coverity, I forgot
    to ensure tmp_ep was always cleared before use.

    Reported-by: Coverity (CID: 166612)
    Fixes: bc028345acc4 ("mtdparts: Fix final outstanding issue reported by Coverity")
    Signed-off-by: Tom Rini

    Tom Rini
     
  • As part of fixing the previously reported issues, it was missed that in
    the case of mtdparts_init() we need to make sure that tmp_ep is long
    enough to contain PARTITION_MAXLEN and a NULL termination. Then, to be
    sure the buffer is NULL terminated, zero the entire buffer rather than
    just ensuring the first character is NULL.

    Cc: Lothar Waßmann
    Cc: Maxime Ripard
    Reported-by: Coverity (CID: 166329)
    Signed-off-by: Tom Rini

    Tom Rini
     

20 Aug, 2017

1 commit

  • Now that sandbox is building cmd/mtdparts.c Coverity has looked at the
    code and found a number of issues. In index_partitions() it is possible
    that part will be NULL, so re-work the checks and debug statements to
    take this into account. We have a number of string buffers that we
    print to in the exact size of, and use string functions on, so we need
    to ensure they are large enough to be NULL terminated. In
    device_parse() it is not possible for num_partitions to be 0 (we would
    have hit a different error first) so remove logically dead code.
    Finally, in parse_mtdparts() if we have an error we need to free the
    memory allocated to dev.

    Cc: Lothar Waßmann
    Cc: Maxime Ripard
    Reported-by: Coverity (CID: 166334, 166333, 166332, 166329, 166328)
    Signed-off-by: Tom Rini

    Tom Rini
     

16 Aug, 2017

4 commits

  • We are now using an env_ prefix for environment functions. Rename these
    other functions as well, for consistency:

    getenv_vlan()
    getenv_bootm_size()
    getenv_bootm_low()
    getenv_bootm_mapsize()
    env_get_default()

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    two functions for consistency. Also add function comments in common.h.

    Quite a few places use getenv() in a condition context, provoking a
    warning from checkpatch. These are fixed up in this patch also.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    commonly used functions, for consistency. Also add function comments in
    common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename setenv()
    for consistency. Also add function comments in common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     

12 Jun, 2017

1 commit

  • commit 06a040a31bcf ("cmd: mtdparts: fix null pointer dereference in parse_mtdparts")
    removed the initialization of a pointer variable, which is
    subsequently used in a debug() call. This produces an uninitialized
    variable warning, when compiling with DEBUG defined.

    Signed-off-by: Lothar Waßmann

    Lothar Waßmann
     

07 Apr, 2017

1 commit

  • CMD_MTDPARTS is something the user might or might not want to select, and
    might depends on (or be selected by) other options too.

    This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT options that
    might change from one board to another, or from one user to the other,
    depending on what it expects and what storage devices are available.

    In order to ease that configuration, add those options to Kconfig.

    Signed-off-by: Maxime Ripard
    Reviewed-by: Tom Rini
    Reviewed-by: Jagan Teki

    Maxime Ripard
     

25 Jul, 2016

1 commit


23 Jul, 2016

5 commits


06 May, 2016

1 commit


06 Feb, 2016

1 commit

  • Correct spelling of "U-Boot" shall be used in all written text
    (documentation, comments in source files etc.).

    Signed-off-by: Bin Meng
    Reviewed-by: Heiko Schocher
    Reviewed-by: Simon Glass
    Reviewed-by: Minkyu Kang

    Bin Meng
     

25 Jan, 2016

1 commit

  • Now that they are in their own directory, we can remove this prefix.
    This makes it easier to find a file since the prefix does not get in the
    way.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Reviewed-by: Heiko Schocher
    Acked-by: Stefan Roese
    Acked-by: Przemyslaw Marczak

    Simon Glass