diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 9 | ||||
-rw-r--r-- | lib/fdtdec.c | 10 | ||||
-rw-r--r-- | lib/net_utils.c | 16 | ||||
-rw-r--r-- | lib/trace.c | 1 |
4 files changed, 24 insertions, 12 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index c9d2767d1d..d7fd21928d 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -27,6 +27,15 @@ config SYS_HZ get_timer() must operate in milliseconds and this option must be set to 1000. +config SYS_VSNPRINTF + bool "Enable safe version of sprintf()" + help + Since sprintf() can overflow its buffer, it is common to use + snprintf() instead, which knows the buffer size and can avoid + overflow. However, this does increase code size slightly (for + Thumb-2, about 420 bytes). Enable this option for safety when + using sprintf() with data you do not control. + source lib/rsa/Kconfig menu "Hashing Support" diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 1a0268a3f9..331eae2ce1 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -42,7 +42,6 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(SAMSUNG_S3C2440_I2C, "samsung,s3c2440-i2c"), COMPAT(SAMSUNG_EXYNOS5_SOUND, "samsung,exynos-sound"), COMPAT(WOLFSON_WM8994_CODEC, "wolfson,wm8994-codec"), - COMPAT(GOOGLE_CROS_EC, "google,cros-ec"), COMPAT(GOOGLE_CROS_EC_KEYB, "google,cros-ec-keyb"), COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"), COMPAT(SAMSUNG_EXYNOS5_XHCI, "samsung,exynos5250-xhci"), @@ -61,13 +60,11 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(INFINEON_SLB9635_TPM, "infineon,slb9635-tpm"), COMPAT(INFINEON_SLB9645_TPM, "infineon,slb9645-tpm"), COMPAT(SAMSUNG_EXYNOS5_I2C, "samsung,exynos5-hsi2c"), - COMPAT(SANDBOX_HOST_EMULATION, "sandbox,host-emulation"), COMPAT(SANDBOX_LCD_SDL, "sandbox,lcd-sdl"), COMPAT(TI_TPS65090, "ti,tps65090"), COMPAT(COMPAT_NXP_PTN3460, "nxp,ptn3460"), COMPAT(SAMSUNG_EXYNOS_SYSMMU, "samsung,sysmmu-v3.3"), COMPAT(PARADE_PS8625, "parade,ps8625"), - COMPAT(COMPAT_INTEL_LPC, "intel,lpc"), COMPAT(INTEL_MICROCODE, "intel,microcode"), COMPAT(MEMORY_SPD, "memory-spd"), COMPAT(INTEL_PANTHERPOINT_AHCI, "intel,pantherpoint-ahci"), @@ -77,6 +74,7 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(INTEL_ICH_SPI, "intel,ich-spi"), COMPAT(INTEL_QRK_MRC, "intel,quark-mrc"), COMPAT(SOCIONEXT_XHCI, "socionext,uniphier-xhci"), + COMPAT(COMPAT_INTEL_PCH, "intel,bd82x6x"), }; const char *fdtdec_get_compatible(enum fdt_compat_id id) @@ -160,8 +158,10 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, } } - if (i == num) + if (i == num) { + ret = -ENXIO; goto fail; + } return 0; } else { @@ -918,7 +918,7 @@ int fdtdec_read_fmap_entry(const void *blob, int node, const char *name, return 0; } -static u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells) +u64 fdtdec_get_number(const fdt32_t *ptr, unsigned int cells) { u64 number = 0; diff --git a/lib/net_utils.c b/lib/net_utils.c index 8d66163159..cfae842752 100644 --- a/lib/net_utils.c +++ b/lib/net_utils.c @@ -12,23 +12,25 @@ #include <common.h> -IPaddr_t string_to_ip(const char *s) +struct in_addr string_to_ip(const char *s) { - IPaddr_t addr; + struct in_addr addr; char *e; int i; + addr.s_addr = 0; if (s == NULL) - return(0); + return addr; - for (addr=0, i=0; i<4; ++i) { + for (addr.s_addr = 0, i = 0; i < 4; ++i) { ulong val = s ? simple_strtoul(s, &e, 10) : 0; - addr <<= 8; - addr |= (val & 0xFF); + addr.s_addr <<= 8; + addr.s_addr |= (val & 0xFF); if (s) { s = (*e) ? e+1 : e; } } - return (htonl(addr)); + addr.s_addr = htonl(addr.s_addr); + return addr; } diff --git a/lib/trace.c b/lib/trace.c index 711e5b5836..ad5e07bd84 100644 --- a/lib/trace.c +++ b/lib/trace.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <mapmem.h> #include <trace.h> #include <asm/io.h> #include <asm/sections.h> |