9
0
Fork 0
Commit Graph

343 Commits

Author SHA1 Message Date
Sascha Hauer 6dd613f1bc string_list: Add string_list_for_each_entry macro
To ease iterating over a string_list.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-03 09:39:16 +02:00
Holger Schurig 9d6df51542 lz4: fix another possible overrun
Note: this is the same as 4148c1f67abf823099b2d7db6851e4aea407f5ee in
linux-git.

There is one other possible overrun in the lz4 code as implemented by
Linux at this point in time (which differs from the upstream lz4
codebase, but will get synced at in a future kernel release.)  As
pointed out by Don, we also need to check the overflow in the data
itself.

While we are at it, replace the odd error return value with just a
"simple" -1 value as the return value is never used for anything other
than a basic "did this work or not" check.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Reported-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Holger Schurig <holgerschurig@gmail.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-02 08:19:45 +02:00
Holger Schurig 918782bb0f lz4: ensure length does not wrap
Note: this is the same as 206204a1162b995e2185275167b22468c00d6b36 in
linux-git.

Given some pathologically compressed data, lz4 could possibly decide to
wrap a few internal variables, causing unknown things to happen.  Catch
this before the wrapping happens and abort the decompression.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Signed-off-by: Holger Schurig <holgerschurig@gmail.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-02 08:19:45 +02:00
Holger Schurig ecb1dc0b1e lzo: properly check for overruns
Note: this is the same as 206a81c18401c0cde6e579164f752c4b147324ce in
linux-git.

The lzo decompressor can, if given some really crazy data, possibly
overrun some variable types.  Modify the checking logic to properly
detect overruns before they happen.

Reported-by: "Don A. Bailey" <donb@securitymouse.com>
Tested-by: "Don A. Bailey" <donb@securitymouse.com>
Signed-off-by: Holger Schurig <holgerschurig@gmail.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-02 08:19:45 +02:00
Herve Codina f2e86a2964 param: Add support for long long read only dev param
Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-13 06:27:34 +02:00
Sascha Hauer 68ad2e4daa gui: IMAGE_RENDERER does not depend on VIDEO
Image renderer may not be particularly useful without framebuffer
support, but technically it does not depend on VIDEO. Fixes:

warning: (CMD_SPLASH) selects IMAGE_RENDERER which has unmet direct dependencies (VIDEO)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-05 10:18:34 +02:00
Sascha Hauer 6331e58a2c Merge branch 'for-next/misc'
Conflicts:
	commands/devinfo.c
2014-06-04 21:03:36 +02:00
Holger Schurig bfd5d7f112 misc: upper-case some abbreviations
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-02 09:07:12 +02:00
Holger Schurig 9b57fd27f5 parameters: only show possible enumerations if there are any
Enumeration values will only be shown if there are at least two of them.
With only one enumeration, it was just repeating what was previously printed
anyway.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-06-02 09:07:12 +02:00
Antony Pavlov 888690bee0 vsprintf: fix formatting
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-05-22 08:11:43 +02:00
Alexander Shiyan 8aede520df lzo: Remove unused variable
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-23 14:00:25 +02:00
Alexander Shiyan 746407bfbe gui: Fix resource leak
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-23 14:00:25 +02:00
Lucas Stach 9c63e92baa treewide: fix signedness mixups in printf format specifiers
This most likely doesn't fix any real bugs, but it's the
right thing to do and reduces the noise level with static
checkers.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-23 09:05:51 +02:00
Sascha Hauer 00e4664675 unlink_recursive: return negative error value
In case of an error unlink_recursive returns errno which is positive.
Return -errno instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-09 09:36:34 +02:00
Sascha Hauer 149e9d8121 Merge branch 'for-next/mtd' 2014-04-04 10:06:22 +02:00
Sascha Hauer 245bc10ca5 Merge branch 'for-next/misc' 2014-04-04 10:06:22 +02:00
Sascha Hauer 1273cc2d47 param: Add dev_add_param_mac
This adds a convenience function to register a MAC address device
parameter. The only current user is converted to use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-04 09:04:31 +02:00
Sascha Hauer 88ffe72278 string.c: Fix include
string.c needs string.h, otherwise we get:

lib/string.c:730: warning: no previous prototype for 'memdup'

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-29 06:49:47 +01:00
Sascha Hauer 380ebff70f splash: Print error message when no renderer is found
the splash command silently fails when no renderer is found for
an image type. Print an error message in this case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-17 08:20:45 +01:00
Dmitry Lavnikevich 1ee640765a mtd: Update internal API to support 64-bit device size
MTD internal API presently uses 32-bit values to represent device
size. This patch updates them to 64-bits but leaves the external API
unchanged.

In general, changing from 32-bit to 64-bit values cause little
or no changes to the majority of the code with the following
exceptions:
  - printk message formats;
  - division and modulus of 64-bit values (mtd_div_by_wb,
    mtd_div_by_eb may be used in some of such cases).

Was tested on phyFLEX i.MX6.

Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com>
Signed-off-by: Grigory Milev <g.milev@sam-solutions.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-12 21:26:37 +01:00
Sascha Hauer cf1b29a850 Merge branch 'for-next/ubi'
Conflicts:
	drivers/mtd/ubi/cdev.c
2014-03-07 09:26:35 +01:00
Sascha Hauer 144358e0aa Merge branch 'for-next/nfs'
Conflicts:
	defaultenv/defaultenv-2-base/bin/ifup
2014-03-07 09:25:44 +01:00
Sascha Hauer a8a08f88cc Merge branch 'for-next/misc'
Conflicts:
	common/environment.c
2014-03-07 09:25:09 +01:00
Sascha Hauer 81ba01fee6 param: dev_add_param_fixed: constify argument
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 11:22:57 +01:00
Fabio Estevam 3472c67ae1 lib: math: Return NULL pointer
Fix the following sparse warning:

lib/math.c:309:16: warning: Using plain integer as NULL pointer

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-24 08:59:04 +01:00
Sascha Hauer 7e66707c76 input: Add BB_ prefix to KEY_ defines
Our KEY_ defines conflict with the standard Linux KEY_ defines, so
add a BB_ prefix to them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-17 08:23:37 +01:00
Uwe Kleine-König f97f4b6571 mount: support filesystem options passed via -o
Similar to mount(8) the barebox command mount now supports passing a string
to the file system driver via -o.

This is used in the next commit to let the user specify port numbers for
nfs mounts.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:02:21 +01:00
Lucas Stach be9758bc17 lib: libbb: f should never be NULL
We assume it to be non NULL in other places, so
we are in much greater trouble if it actually is.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 08:49:55 +01:00
Lucas Stach efe314434f lib: math: fix return path (numstack may be NULL)
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 08:49:55 +01:00
Lucas Stach aa6694b542 remove redundant NULL check on free
free() already checks the pointer to be non
NULL. No need to do it again.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 08:49:55 +01:00
Sascha Hauer 32f9b1079a Merge branch 'for-next/misc' 2014-01-07 11:57:51 +01:00
Robert Jarzmik 0cff096e58 lib: libubigen math compile error fix
A compile error appears in libubigen on PXA architecture, because of a
division of an long long by a int :
/home/rj/mio_linux/barebox/lib/libubigen.c:105: undefined reference to
`__aeabi_ldivmod' arm-linux-gnueabi-ld: BFD (GNU Binutils for Debian)
2.20.1.20100303 assertion fail ../../bfd/elf32-arm.c:12497

Fix it by using div_u64 instead.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-06 10:58:00 +01:00
Antony Pavlov c2ffad8855 lib: fix whitespace, drop blank lines at EOF
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-06 09:24:22 +01:00
Sascha Hauer d7fe5e2263 mtd: Add subpagesize to mtd_info_user
ubiformat needs the subpagesize to work correctly. The kernel uses
sysfs to pass the subpagesize, but in barebox we have the possibility
to extend struct mtd_info_user. Add a corresponding field and use it
in ubiformat.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-20 15:04:30 +01:00
Sascha Hauer ed039cd72b Merge branch 'for-next/omap-drivers' 2013-12-06 08:23:27 +01:00
Sascha Hauer e9ea6eeaab Merge branch 'for-next/misc'
Conflicts:
	scripts/Makefile
2013-12-06 08:23:24 +01:00
Sascha Hauer 54f55d79d9 string: Add (x)memdup
It's a common task to duplicate some memory. Add (x)memdup functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-27 10:42:54 +01:00
Alexander Aring 32a5775125 barebox: remove double semicolons
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-18 10:13:35 +01:00
Sascha Hauer 6058a2273c readline: remove unused variable
'rc' is never set to anything else than 0, so drop it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:45:03 +01:00
Alexander Shiyan 960eb40d02 gui: Fix signed/unsigned arguments for printf
"%u" in format string requires a unsigned integer.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-11 08:52:05 +01:00
Sascha Hauer b67b2671c2 treewide: Add missing includes
A lot of files rely on include/driver.h including include/of.h (and
this including include/errno.h. include the files explicitly so we can
eventually get rid of including of.h from driver.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:42:04 +01:00
Andre Heider 9617cfecbe gui: convert the bmp renderer to respect line_length
Signed-off-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 09:59:04 +01:00
Andre Heider 3ad1765467 gui: convert graphic utils to respect line_length
Signed-off-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 09:59:04 +01:00
Sascha Hauer 51dce5facb add function to read single line files
Often small files are used to store the value od a variable. This
adds a function to easily read such a variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 14:04:20 +02:00
Sascha Hauer 33c56e21eb Merge branch 'for-next/misc'
Conflicts:
	commands/Makefile
2013-10-07 08:00:25 +02:00
Sascha Hauer c26a46f0db Merge branch 'for-next/lzo' 2013-10-07 08:00:16 +02:00
Sascha Hauer d4f5bb1e01 copy_file: Add missing O_TRUNC
Without it, when copying a smaller file over a larger file the
resulting file still has the remaining space from the larger file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-29 12:10:59 +02:00
Teresa Gámez e2b67d6a6a lib: Fix copy_file when filesize is FILESIZE_MAX
Using tftp command does not work proper when files
have FILESIZE_MAX, as copy_file and show_progress
can not handle it. Check the file size for FILESIZE_MAX
and handle it as file size = 0.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-27 16:20:17 +02:00
Jean-Christophe PLAGNIOL-VILLARD e7aab5c844 lzo: update to lzo-2013
take from linux next-20130227
same version as v3.11

before

-rwxr-xr-x 1 root root 123001 Feb 28 01:04 build/highbank/arch/arm/pbl/zbarebox.bin

after

-rwxr-xr-x 1 root root 122226 Feb 28 01:02 build/highbank/arch/arm/pbl/zbarebox.bin

smaller and faster

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-22 16:48:46 +02:00
Jean-Christophe PLAGNIOL-VILLARD 56ee5d3aac process_escape_sequence: add support to \$?
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-18 09:17:13 +02:00