Skip to contentSkip to conversation

imx: mx6/7 define CONFIG_SYS_VSNPRINTF

PATCH New Peng Fan 3 participants 4 messages Jan 12, 2016 – Jan 14, 2016

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 imx: mx6/7 define CONFIG_SYS_VSNPRINTF

From: Peng Fan <[email protected]>

Define CONFIG_SYS_VSNPRINTF to use snprintf. If not define CONFIG_SYS_VSNPRINTF, snprintf is sprintf.

Report by Coverity:
pass string init_val of unknown size to sprintf

Cc Peter Robinson <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Adrian Alonso <[email protected]>
Cc Stefano Babic <[email protected]>
---
 include/configs/mx6_common.h | 4 ++++
 include/configs/mx7_common.h | 4 ++++
 2 files changed, 8 insertions(+)
include/configs/mx6_common.h +4 -0
index 1fd7ce3..1a470a4 100644
@@ -17,6 +17,10 @@
 #ifndef __MX6_COMMON_H
 #define __MX6_COMMON_H
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_VSNPRINTF
+#endif
+
 #ifndef CONFIG_MX6UL
 #define CONFIG_ARM_ERRATA_743622
 #define CONFIG_ARM_ERRATA_751472
include/configs/mx7_common.h +4 -0
index d507fb4..505f6cc 100644
@@ -13,6 +13,10 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/imx-common/gpio.h>
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_SYS_VSNPRINTF
+#endif
+
 #ifndef CONFIG_MX7
 #define CONFIG_MX7
 #endif
Signature · 1 line
2.6.2
#1 lore raw

PATCH 1/1 imx: mx6/7 define CONFIG_SYS_VSNPRINTF

Quoted 5 lines · Peng Fan

From: Peng Fan <[email protected]>

Define CONFIG_SYS_VSNPRINTF to use snprintf. If not define CONFIG_SYS_VSNPRINTF, snprintf is sprintf.

Quoted 8 lines

Report by Coverity:
pass string init_val of unknown size to sprintf

Cc Peter Robinson <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Adrian Alonso <[email protected]>
Cc Stefano Babic <[email protected]>

I'm not sure how I feel about fixing this range of issues only for certain targets. I need to do some global building here and see what happens.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160113/86d0e204/attachment.sig>
author
#2 lore raw

PATCH 1/1 imx: mx6/7 define CONFIG_SYS_VSNPRINTF

Hi Tom,

Quoted 16 lines · Tom Rini
Quoted 5 lines · Peng Fan

From: Peng Fan <[email protected]>

Define CONFIG_SYS_VSNPRINTF to use snprintf. If not define CONFIG_SYS_VSNPRINTF, snprintf is sprintf.

Quoted 8 lines

Report by Coverity:
pass string init_val of unknown size to sprintf

Cc Peter Robinson <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Adrian Alonso <[email protected]>
Cc Stefano Babic <[email protected]>
Quoted 3 lines

I'm not sure how I feel about fixing this range of issues only for certain targets. I need to do some global building here and see what happens.

With CONFIG_SYS_VSNPRINTF defined, image size may be bigger. So here, I use #ifdef CONFIG_SPL_BUILD.

Ok, wait for your further comments on this.

Regards,
Peng.

Quoted 3 lines
Signature · 2 lines
-- 
Tom
#3 lore raw

PATCH 1/1 imx: mx6/7 define CONFIG_SYS_VSNPRINTF

In reply to Tom Rini
Quoted 16 lines · Tom Rini
Quoted 5 lines · Peng Fan

From: Peng Fan <[email protected]>

Define CONFIG_SYS_VSNPRINTF to use snprintf. If not define CONFIG_SYS_VSNPRINTF, snprintf is sprintf.

Quoted 8 lines

Report by Coverity:
pass string init_val of unknown size to sprintf

Cc Peter Robinson <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Adrian Alonso <[email protected]>
Cc Stefano Babic <[email protected]>
Quoted 3 lines

I'm not sure how I feel about fixing this range of issues only for certain targets. I need to do some global building here and see what happens.

I'm not sure it's 100% the same, not had time to look closely, but it looks similar to a build regression I'm seeing in the 2016.01 GA that wasn't in RC4. Snippet below, or full build log at [1]

Peter

gcc -Wp,-MD,spl/lib/.strto.o.d -nostdinc -isystem
/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/5.3.1/include -Iinclude -I/builddir/build/BUILD/u-boot-2016.01/include -I/builddir/build/BUILD/u-boot-2016.01/arch/arm/include -include /builddir/build/BUILD/u-boot-2016.01/include/linux/kconfig.h -I/builddir/build/BUILD/u-boot-2016.01/spl/lib -Ispl/lib -D__KERNEL__ -D__UBOOT__ -DCONFIG_SYS_TEXT_BASE=0x00100000 -DCONFIG_SPL_BUILD -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -Os -fno-stack-protector -fno-delete-null-pointer-checks -g -fstack-usage -Wno-format-nonliteral -Werror=date-time -ffunction-sections -fdata-sections -D__ARM__ -Wa,-mimplicit-it=always -mthumb -mthumb-interwork -mabi=aapcs-linux -mno-unaligned-access -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -msoft-float -pipe -march=armv7-a -I/builddir/build/BUILD/u-boot-2016.01/arch/arm/mach-rockchip/include
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(strto)"
-D"KBUILD_MODNAME=KBUILD_STR(strto)" -c -o spl/lib/strto.o /builddir/build/BUILD/u-boot-2016.01/lib/strto.c
ld.bfd -r -o spl/lib/built-in.o spl/lib/libfdt/built-in.o
spl/lib/fdtdec_common.o spl/lib/fdtdec.o spl/lib/hashtable.o spl/lib/errno.o spl/lib/display_options.o spl/lib/crc32.o spl/lib/ctype.o spl/lib/div64.o spl/lib/hang.o spl/lib/linux_compat.o spl/lib/linux_string.o spl/lib/membuff.o spl/lib/slre.o spl/lib/string.o spl/lib/time.o spl/lib/uuid.o spl/lib/tiny-printf.o spl/lib/panic.o spl/lib/strto.o
(cd spl && ld.bfd -T u-boot-spl.lds --gc-sections -Bstatic
--gc-sections -Ttext 0xff704004 arch/arm/cpu/armv7/start.o --start-group arch/arm/mach-rockchip/built-in.o arch/arm/cpu/armv7/built-in.o arch/arm/cpu/built-in.o arch/arm/lib/built-in.o board/google/chromebook_jerry/built-in.o board/google/common/built-in.o common/spl/built-in.o common/init/built-in.o common/built-in.o drivers/built-in.o dts/built-in.o fs/built-in.o lib/built-in.o --end-group arch/arm/lib/eabi_compat.o arch/arm/lib/lib.a -Map u-boot-spl.map -o u-boot-spl)
drivers/built-in.o: In function `spi_flash_probe_bus_cs':
/builddir/build/BUILD/u-boot-2016.01/drivers/mtd/spi/sf-uclass.c:61:
undefined reference to `sprintf' /builddir/build/BUILD/u-boot-2016.01/scripts/Makefile.spl:244: recipe for target 'spl/u-boot-spl' failed
make[2]: *** [spl/u-boot-spl] Error 1 /builddir/build/BUILD/u-boot-2016.01/Makefile:1330: recipe for target 'spl/u-boot-spl' failed
make[1]: Leaving directory '/builddir/build/BUILD/u-boot-2016.01/builds/chromebook_jerry' make[1]: *** [spl/u-boot-spl] Error 2
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

[1] https://kojipkgs.fedoraproject.org//work/tasks/2458/12522458/build.log