Commit Graph

17 Commits

Author SHA1 Message Date
Veli-Pekka Peltola 8044c1387f ubifs: Fix ubifsload when using ZLIB
Using ZLIB compression with UBIFS fails if last data node is not a size of
UBIFS_BLOCK_SIZE (4096 bytes).

Easiest way to test this is trying to read a file smaller than 4k:
=> ubifsload 41000000 /etc/fstab
Loading file '/etc/fstab' to addr 0x41000000 with size 704 (0x000002c0)...
UBIFS error (pid 0): read_block: bad data node (block 0, inode 2506)
UBIFS error (pid 0): do_readpage: cannot read page 0 of inode 2506, error -22
Error reading file '/etc/fstab'
/etc/fstab not found!
exit not allowed from main input shell.
=>

With this patch:

=> ubifsload 41000000 /etc/fstab
Loading file '/etc/fstab' to addr 0x41000000 with size 704 (0x000002c0)...
Done
=>

Signed-off-by: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Cc: kmpark@infradead.org
Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2012-09-10 11:37:42 +02:00
Stefan Roese be73913b91 ubifs: Fix memory leak in ubifs_finddir
This patch fixes a memory leak in ubifs_finddir().

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: dev.ma.dma@gmail.com
2012-09-03 11:37:50 +02:00
Wolfgang Denk aaf6935b22 UBIFS: fix warning: format '%lX' expects type 'long unsigned int'
Commit 46d7274 "UBIFS: Change ubifsload to set the filesize variable"
introduced the follwing compiler warning:

ubifs.c: In function 'ubifs_load':
ubifs.c:742: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'u32'

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Bastian Ruppert <Bastian.Ruppert@Sewerin.de>
2011-09-10 01:10:32 +02:00
Bastian Ruppert 46d7274cdc UBIFS: Change ubifsload to set the filesize variable
This is the same behaviour like tftp or fatload command.

Signed-off-by: Bastian Ruppert <Bastian.Ruppert@Sewerin.de>
CC: kmpark@infradead.org
Acked-by: Detlev Zundel <dzu@denx.de>
2011-09-10 00:04:29 +02:00
Wolfgang Denk 3267bc1b2b ubifs: Fix bad free() sequence in ubifs_finddir()
Free private_data member element before freeing file structure.
This was causing malloc to crash. Also remove unnecessary variable
assigments as file structure gets free'd as well.

Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2011-08-19 17:21:02 +02:00
Ricardo Ribalda Delgado 64b6817848 ubifs.c: BUG: Error following links
The link_name variable is declared inside the if block and it is used
outside it through the name pointer.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 18:24:04 +01:00
Stefan Roese b1a14f8a1c UBIFS: Change ubifsload to not read beyond the requested size
Until now ubifsload pads the destination with 0 up to a multiple of
UBIFS_BLOCK_SIZE (4KiB) while reading a file to memory. This patch
changes this behaviour to only read to the requested length. This
is either the file length or the length/size provided as parameter
to the ubifsload command.

Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 16:33:47 +01:00
Wolfgang Denk 2e5167ccad Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOC
By now, the majority of architectures have working relocation
support, so the few remaining architectures have become exceptions.
To make this more obvious, we make working relocation now the default
case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-10-29 21:32:07 +02:00
Heiko Schocher 4b142febff common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL
There is more and more usage of printing 64bit values,
so enable this feature generally, and delete the
CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL
defines.

Signed-off-by: Heiko Schocher <hs@denx.de>
2009-12-08 22:14:07 +01:00
Peter Tyser 521af04d85 Conditionally perform common relocation fixups
Add #ifdefs where necessary to not perform relocation fixups.  This
allows boards/architectures which support relocation to trim a decent
chunk of code.

Note that this patch doesn't add #ifdefs to architecture-specific code
which does not support relocation.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-10-03 10:17:57 +02:00
Simon Kagstrom ef37c6835e ubifs: Correct dereferencing of files-after-symlinks
Files in directories which are symlinked to were not dereferenced
correctly in last commit. E.g., with a symlink

   /boot/lnk -> /boot/real_dir

loading

   /boot/lnk/uImage

will fail. This patch fixes that by simply seeing to it that the target
base directory has a slash after it.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-09-28 16:58:31 +02:00
Simon Kagstrom 9d7952e4c6 ubifs: Add support for looking up directory and relative symlinks
This patch adds support for resolving symlinks to directories as well as
relative symlinks. Symlinks are now always resolved during file lookup,
so the load stage no longer needs to special-case them.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-09-23 15:58:05 +02:00
Daniel Mack 165f9859b6 ubifs: fix small error path mismatch
In do_readpage(), don't free 'dn' if its allocation failed.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
2009-06-09 23:11:53 +02:00
Ricardo Ribalda Delgado c1a0fd5f28 ubifs: BUG: Blocks commpressed with zlib
Blocks compressed with zlib dont have the full gzip header.

Without this patch, block compressed with zlib cannot be readed!

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
2009-04-30 23:07:04 +02:00
Ricardo Ribalda Delgado dbd3361440 ubifs: BUG realpath string must be ended with NULL
If the memory used to copy the link_make is "dirty" the string wont
be ended with NULL, throwing out multiple memory bugs.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@uam.es>
Acked-by: Stefan Roese <sr@denx.de>
2009-04-28 01:21:36 +02:00
Michael Lawnick faac4fd852 UBIFS: Missing offset relocation for compressor 'none'
On systems where U-Boot is linked to another address than it really lays
(e.g. backup image), calls via function pointers must be fixed with a
'+= gd->reloc_off'.
This was not done for none_compr in ubifs_compressors_init() what leads
to system crash on ubifsmount command.

Signed-off-by: Michael Lawnick <ml.lawnick@gmx.de>
Acked-by: Stefan Roese <sr@denx.de>
2009-03-20 22:39:15 +01:00
Stefan Roese 9eefe2a2b3 UBIFS: Implement read-only UBIFS support in U-Boot
The U-Boot UBIFS implementation is largely a direct copy from the current
Linux version (2.6.29-rc6). As already done in the UBI version we have an
"abstraction layer" to redefine or remove some OS calls (e.g. mutex_lock()
...). This makes it possible to use the original Linux code with very
little changes. And by this we can better update to later Linux versions.

I removed some of the Linux features that are not used in the U-Boot
version (e.g. garbage-collection, write support).

Signed-off-by: Stefan Roese <sr@denx.de>
CC: Artem Bityutskiy <dedekind@infradead.org>
CC: Adrian Hunter <ext-Adrian.Hunter@nokia.com>
2009-03-20 22:39:15 +01:00