1. 11 Oct, 2015 5 commits
  2. 11 Sep, 2015 8 commits
    • Gary Bisson's avatar
      fs: ext4: fix symlink read function · 9d2f6a9a
      Gary Bisson authored
      Since last API changes for files >2GB, the read of symlink is broken as
      ext4fs_read_file now returns 0 instead of the length of the actual read.
      Signed-off-by: default avatarGary Bisson <gary.bisson@boundarydevices.com>
      9d2f6a9a
    • Stephen Warren's avatar
      ext4: fix leak in check_filename() · d56b2015
      Stephen Warren authored
      root_first_block_buffer should be free()d in all cases, not just when an
      error occurs. Fix the success exit path of the function to do this.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Tested-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      d56b2015
    • Stephen Warren's avatar
      ext4: free allocations by parse_path() · 934b14f2
      Stephen Warren authored
      parse_path() malloc()s the entries in the array it's passed. Those
      allocations must be free()d by the caller, ext4fs_get_parent_inode_num().
      Add code to do this.
      
      For this to work, all the array entries must be dynamically allocated,
      rather than a mix of dynamic and static allocations. Fix parse_path() not
      to over-write arr[0] with a pointer to statically allocated data.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Tested-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      934b14f2
    • Stephen Warren's avatar
      ext4: avoid calling ext4fs_mount() twice, which leaks · 676505f5
      Stephen Warren authored
      ext4_write_file() is only called from the "fs" layer, which calls both
      ext4fs_mount() and ext4fs_close() before/after calling ext4_write_file().
      Fix ext4_write_file() not to call ext4fs_mount() again, since the mount
      operation malloc()s some RAM which is leaked when a second mount call
      over-writes the pointer to that data, if no intervening close call is
      made.
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Acked-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      Tested-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      676505f5
    • Łukasz Majewski's avatar
      FIX: fat: Provide correct return code from disk_{read|write} to upper layers · 0a04ed86
      Łukasz Majewski authored
      It is very common that FAT code is using following pattern:
      if (disk_{read|write}() < 0)
              return -1;
      
      Up till now the above code was dead, since disk_{read|write) could only
      return value >= 0.
      As a result some errors from medium layer (i.e. eMMC/SD) were not caught.
      
      The above behavior was caused by block_{read|write|erase} declared at
      struct block_dev_desc (@part.h). It returns unsigned long, where 0
      indicates error and > 0 indicates that medium operation was correct.
      
      This patch as error regards 0 returned from block_{read|write|erase}
      when nr_blocks is grater than zero. Read/Write operation with nr_blocks=0
      should return 0 and hence is not considered as an error.
      Signed-off-by: default avatarLukasz Majewski <l.majewski@samsung.com>
      
      Test HW: Odroid XU3 - Exynos 5433
      0a04ed86
    • Simon Glass's avatar
      Move ALLOC_CACHE_ALIGN_BUFFER() to the new memalign.h header · cf92e05c
      Simon Glass authored
      Now that we have a new header file for cache-aligned allocation, we should
      move the stack-based allocation macro there also.
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      cf92e05c
    • Simon Glass's avatar
      Move malloc_cache_aligned() to its own header · 6e295186
      Simon Glass authored
      At present malloc.h is included everywhere since it recently was added to
      common.h in this commit:
      
         4519668b mtd/nand/ubi: assortment of alignment fixes
      
      This seems wasteful and unnecessary. We have been trying to trim down
      common.h and put separate functions into separate header files and that
      change goes in the opposite direction.
      
      Move malloc_cache_aligned() to a new header so that this can be avoided.
      The header would perhaps be better named as alignmem.h but it needs to be
      included after common.h and people might be confused by this. With the name
      memalign.h it fits nicely after malloc() in most cases.
      Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
      Acked-by: default avatarMarcel Ziswiler <marcel.ziswiler@toradex.com>
      6e295186
    • Stephen Warren's avatar
      fat: handle paths that include ../ · 18a10d46
      Stephen Warren authored
      The FAT code contains a special case to parse the root directory. This
      is needed since the root directory location/layout on disk is special
      cased for FAT12/16. In particular, the location and size of the FAT12/16
      root directory is hard-coded and contiguous, whereas all FAT12/16 non-root
      directories, and all FAT32 directories, are stored in a non-contiguous
      fashion, with the layout represented by a linked-list of clusters in the
      FAT.
      
      If a file path contains ../ (for example /extlinux/../bcm2835-rpi-cm.dtb),
      it is possible to need to parse the root directory for the first element
      in the path (requiring application of the special case), then a sub-
      directory (in the general way), then re-parse the root directory (again
      requiring the special case). However, the current code in U-Boot only
      applies the special case for the very first path element, and never for
      any later path element. When reparsing the root directory without
      applying the special case, any file in a sector (or cluster?) other than
      the first sector/cluster of the root directory will not be found.
      
      This change modifies the non-root-dir-parsing loop of do_fat_read_at()
      to detect if it's walked back to the root directory, and if so, jumps
      back to the special case code that handles parsing of the root directory.
      
      This change was tested using sandbox by executing:
      
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/.."
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup/"
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup/.."
      ./u-boot -c "host bind 0 ../sd-p1.bin; ls host 0:0 /extlinux/../backup/../"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /extlinux/../bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /backup/../bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /extlinux/..backup/../bcm2835-rpi-cm.dtb"
      ./u-boot -c "host bind 0 ../sd-p1.bin; load host 0:0 0 /extlinux/../backup/../bcm2835-rpi-cm.dtb"
      
      (/extlinux and /backup are in different sectors so trigger some different
      cases, and bcm2835-rpi-cm.dtb is in a sector of the root directory other
      than the first).
      
      In all honesty, this change is a bit of a hack, using goto and all.
      However, as demonstrated above it appears to work well in practice, is
      quite minimal, likely doesn't introduce any risk of regressions, and
      hopefully doesn't introduce any maintenance issues.
      
      The correct fix would be to collapse the root and non-root loops in
      do_fat_read_at() and get_dentfromdir() into a single loop that has a
      small special-case when moving from one sector to the next, to handle
      the layout difference of root/non-root directories. AFAIK all other
      aspects of directory parsing are identical. However, that's a much
      larger change which needs significantly more thought before it's
      implemented.
      Signed-off-by: default avatarStephen Warren <swarren@wwwdotorg.org>
      18a10d46
  3. 28 Aug, 2015 1 commit
  4. 13 Aug, 2015 9 commits
  5. 19 Apr, 2015 1 commit
  6. 18 Apr, 2015 1 commit
  7. 06 Mar, 2015 1 commit
  8. 29 Jan, 2015 2 commits
  9. 28 Jan, 2015 1 commit
  10. 05 Jan, 2015 1 commit
    • Przemyslaw Marczak's avatar
      fs: fat: read: fix fat16 ls/read issue · 64f65e1e
      Przemyslaw Marczak authored
      The present fat implementation ignores FAT16 long name
      directory entries which aren't placed in a single sector.
      
      This was becouse of the buffer was always filled by the
      two sectors, and the loop was made also for two sectors.
      
      If some file long name entries are stored in two sectors,
      the we have two cases:
      
      Case 1:
      Both of sectors are in the buffer - all required data
      for long file name is in the buffer.
      - Read OK!
      
      Case 2:
      The current directory entry is placed at the end of the
      second buffered sector. And the next entries are placed
      in a sector which is not buffered yet. Then two next
      sectors are buffered and the mentioned entry is ignored.
      - Read fail!
      
      This commit fixes this issue by:
      - read two sectors after loop on each single is done
      - keep the last used sector as a first in the buffer
        before the read of two next
      
      The commit doesn't affects the fat32 imlementation,
      which works good as previous.
      Signed-off-by: default avatarPrzemyslaw Marczak <p.marczak@samsung.com>
      Cc: Mikhail Zolotaryov <lebon@lebon.org.ua>
      Cc: Tom Rini <trini@ti.com>
      Cc: Stephen Warren <swarren@nvidia.com>
      Cc: Simon Glass <sjg@chromium.org>
      Cc: Suriyan Ramasami <suriyan.r@gmail.com>
      Cc: Lukasz Majewski <l.majewski@samsung.com>
      Cc: Wolfgang Denk <wd@denx.de>
      Tested-by: default avatarSimon Glass <sjg@chomium.org>
      64f65e1e
  11. 01 Dec, 2014 1 commit
  12. 23 Nov, 2014 6 commits
  13. 20 Nov, 2014 1 commit
    • Masahiro Yamada's avatar
      include: move various macros to include/linux/kernel.h · cba1da49
      Masahiro Yamada authored
      U-Boot has imported various utility macros from Linux
      scattering them to various places without consistency.
      
      In include/common.h are min, max, min3, max3, ARRAY_SIZE, ALIGN,
      container_of, DIV_ROUND_UP, etc.
      In include/linux/compat.h are min_t, max_t, round_up, round_down,
      etc.
      We also have duplicated defines of min_t in some *.c files.
      
      Moreover, we are suffering from too cluttered include/common.h.
      
      This commit moves various macros that originate in
      include/linux/kernel.h of Linux to their original position.
      
      Note:
      This commit simply moves the macros; the macros roundup,
      min, max, min2, max3, ARRAY_SIZE are different
      from those of Linux at this point.
      Signed-off-by: default avatarMasahiro Yamada <yamada.m@jp.panasonic.com>
      cba1da49
  14. 10 Nov, 2014 1 commit
    • Jorgen Lundman's avatar
      ZFS: Clean up cppcheck warnings where relevant, leaked memory etc · e183de0d
      Jorgen Lundman authored
      In a message from Wolfgang Denk highlighting warnings from cppcheck,
      the patch will address those that are correctly diagnosed. Some are
      false-positives:
      
      > [fs/zfs/zfs.c:937]: (error) Memory leak: l
      dmu_read() allocates "l" if successful, so error-case should not free
      it.
      > [fs/zfs/zfs.c:1141]: (error) Memory leak: dnbuf
      dmu_read() allocates "dnbuf" if successful, so error-case should not
      free it.
      > [fs/zfs/zfs.c:1372]: (error) Memory leak: osp
      zio_read() allocates "osp" if successful, so error-case should
      not free it.
      > [fs/zfs/zfs.c:1726]: (error) Memory leak: nvlist
      int_zfs_fetch_nvlist() allocates "nvlist" if successful, so error-case
      should not free it.
      Signed-off-by: default avatarJorgen Lundman <lundman@lundman.net>
      e183de0d
  15. 27 Oct, 2014 1 commit