From 192bc6948b02ff4168cab16162fffb507946dc2b Mon Sep 17 00:00:00 2001 From: Ben Whitten Date: Wed, 30 Dec 2015 13:05:58 +0000 Subject: Fix GCC format-security errors and convert sprintfs. With format-security errors turned on, GCC picks up the use of sprintf with a format parameter not being a string literal. Simple uses of sprintf are also converted to use strcpy. Signed-off-by: Ben Whitten Acked-by: Wolfgang Denk Reviewed-by: Tom Rini --- board/freescale/b4860qds/eth_b4860qds.c | 8 ++++---- board/freescale/corenet_ds/eth_hydra.c | 2 +- board/freescale/corenet_ds/eth_superhydra.c | 2 +- board/freescale/ls1021aqds/eth.c | 2 +- board/freescale/ls1043aqds/eth.c | 2 +- board/freescale/ls2080aqds/eth.c | 2 +- board/freescale/t102xqds/eth_t102xqds.c | 2 +- board/freescale/t1040qds/eth.c | 2 +- board/freescale/t208xqds/eth_t208xqds.c | 2 +- board/freescale/t4qds/eth.c | 2 +- board/gdsys/common/ihs_mdio.c | 2 +- board/keymile/common/common.c | 4 ++-- board/mpl/common/common_util.c | 8 ++++---- board/samsung/universal_c210/universal.c | 4 ++-- board/siemens/rut/board.c | 2 +- board/vscom/baltos/board.c | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) (limited to 'board') diff --git a/board/freescale/b4860qds/eth_b4860qds.c b/board/freescale/b4860qds/eth_b4860qds.c index df90476a77..4b2303e849 100644 --- a/board/freescale/b4860qds/eth_b4860qds.c +++ b/board/freescale/b4860qds/eth_b4860qds.c @@ -408,22 +408,22 @@ void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr, sizeof(f_link)); break; case 0x98: /* XAUI interface */ - sprintf(alias, "phy_xaui_slot1"); + strcpy(alias, "phy_xaui_slot1"); fdt_status_okay_by_alias(fdt, alias); - sprintf(alias, "phy_xaui_slot2"); + strcpy(alias, "phy_xaui_slot2"); fdt_status_okay_by_alias(fdt, alias); break; case 0x9e: /* XAUI interface */ case 0x9a: case 0x93: case 0x91: - sprintf(alias, "phy_xaui_slot1"); + strcpy(alias, "phy_xaui_slot1"); fdt_status_okay_by_alias(fdt, alias); break; case 0x97: /* XAUI interface */ case 0xc3: - sprintf(alias, "phy_xaui_slot2"); + strcpy(alias, "phy_xaui_slot2"); fdt_status_okay_by_alias(fdt, alias); break; default: diff --git a/board/freescale/corenet_ds/eth_hydra.c b/board/freescale/corenet_ds/eth_hydra.c index 172a55b988..55437e843d 100644 --- a/board/freescale/corenet_ds/eth_hydra.c +++ b/board/freescale/corenet_ds/eth_hydra.c @@ -170,7 +170,7 @@ static int hydra_mdio_init(char *realbusname, char *fakebusname) bus->read = hydra_mdio_read; bus->write = hydra_mdio_write; bus->reset = hydra_mdio_reset; - sprintf(bus->name, fakebusname); + strcpy(bus->name, fakebusname); hmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/corenet_ds/eth_superhydra.c b/board/freescale/corenet_ds/eth_superhydra.c index 62b163580b..3f11f5f279 100644 --- a/board/freescale/corenet_ds/eth_superhydra.c +++ b/board/freescale/corenet_ds/eth_superhydra.c @@ -175,7 +175,7 @@ static int super_hydra_mdio_init(char *realbusname, char *fakebusname) bus->read = super_hydra_mdio_read; bus->write = super_hydra_mdio_write; bus->reset = super_hydra_mdio_reset; - sprintf(bus->name, fakebusname); + strcpy(bus->name, fakebusname); hmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/ls1021aqds/eth.c b/board/freescale/ls1021aqds/eth.c index be351befec..bf3e08a8cf 100644 --- a/board/freescale/ls1021aqds/eth.c +++ b/board/freescale/ls1021aqds/eth.c @@ -113,7 +113,7 @@ static int ls1021a_mdio_init(char *realbusname, char *fakebusname) bus->read = ls1021a_mdio_read; bus->write = ls1021a_mdio_write; bus->reset = ls1021a_mdio_reset; - sprintf(bus->name, fakebusname); + strcpy(bus->name, fakebusname); lsmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/ls1043aqds/eth.c b/board/freescale/ls1043aqds/eth.c index b7fc360e2c..88b10a0f2f 100644 --- a/board/freescale/ls1043aqds/eth.c +++ b/board/freescale/ls1043aqds/eth.c @@ -136,7 +136,7 @@ static int ls1043aqds_mdio_init(char *realbusname, u8 muxval) bus->read = ls1043aqds_mdio_read; bus->write = ls1043aqds_mdio_write; bus->reset = ls1043aqds_mdio_reset; - sprintf(bus->name, ls1043aqds_mdio_name_for_muxval(muxval)); + strcpy(bus->name, ls1043aqds_mdio_name_for_muxval(muxval)); pmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index 0637ecf2a7..ebc9d47468 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -412,7 +412,7 @@ static int ls2080a_qds_mdio_init(char *realbusname, u8 muxval) bus->read = ls2080a_qds_mdio_read; bus->write = ls2080a_qds_mdio_write; bus->reset = ls2080a_qds_mdio_reset; - sprintf(bus->name, ls2080a_qds_mdio_name_for_muxval(muxval)); + strcpy(bus->name, ls2080a_qds_mdio_name_for_muxval(muxval)); pmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/t102xqds/eth_t102xqds.c b/board/freescale/t102xqds/eth_t102xqds.c index 99c23f79f4..ca54e2a4f0 100644 --- a/board/freescale/t102xqds/eth_t102xqds.c +++ b/board/freescale/t102xqds/eth_t102xqds.c @@ -148,7 +148,7 @@ static int t1024qds_mdio_init(char *realbusname, u8 muxval) bus->read = t1024qds_mdio_read; bus->write = t1024qds_mdio_write; bus->reset = t1024qds_mdio_reset; - sprintf(bus->name, t1024qds_mdio_name_for_muxval(muxval)); + strcpy(bus->name, t1024qds_mdio_name_for_muxval(muxval)); pmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/t1040qds/eth.c b/board/freescale/t1040qds/eth.c index 8bf34fa79a..872e6e8228 100644 --- a/board/freescale/t1040qds/eth.c +++ b/board/freescale/t1040qds/eth.c @@ -162,7 +162,7 @@ static int t1040_qds_mdio_init(char *realbusname, u8 muxval) bus->read = t1040_qds_mdio_read; bus->write = t1040_qds_mdio_write; bus->reset = t1040_qds_mdio_reset; - sprintf(bus->name, t1040_qds_mdio_name_for_muxval(muxval)); + strcpy(bus->name, t1040_qds_mdio_name_for_muxval(muxval)); pmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/t208xqds/eth_t208xqds.c b/board/freescale/t208xqds/eth_t208xqds.c index 1c0ce2492c..f08cff2654 100644 --- a/board/freescale/t208xqds/eth_t208xqds.c +++ b/board/freescale/t208xqds/eth_t208xqds.c @@ -176,7 +176,7 @@ static int t208xqds_mdio_init(char *realbusname, u8 muxval) bus->read = t208xqds_mdio_read; bus->write = t208xqds_mdio_write; bus->reset = t208xqds_mdio_reset; - sprintf(bus->name, t208xqds_mdio_name_for_muxval(muxval)); + strcpy(bus->name, t208xqds_mdio_name_for_muxval(muxval)); pmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/freescale/t4qds/eth.c b/board/freescale/t4qds/eth.c index 2dfdcbbd39..83a3a9bba2 100644 --- a/board/freescale/t4qds/eth.c +++ b/board/freescale/t4qds/eth.c @@ -153,7 +153,7 @@ static int t4240qds_mdio_init(char *realbusname, u8 muxval) bus->read = t4240qds_mdio_read; bus->write = t4240qds_mdio_write; bus->reset = t4240qds_mdio_reset; - sprintf(bus->name, t4240qds_mdio_name_for_muxval(muxval)); + strcpy(bus->name, t4240qds_mdio_name_for_muxval(muxval)); pmdio->realbus = miiphy_get_dev_by_name(realbusname); diff --git a/board/gdsys/common/ihs_mdio.c b/board/gdsys/common/ihs_mdio.c index 1d6eb7bd55..262ead5516 100644 --- a/board/gdsys/common/ihs_mdio.c +++ b/board/gdsys/common/ihs_mdio.c @@ -80,7 +80,7 @@ int ihs_mdio_init(struct ihs_mdio_info *info) bus->read = ihs_mdio_read; bus->write = ihs_mdio_write; bus->reset = ihs_mdio_reset; - sprintf(bus->name, info->name); + strcpy(bus->name, info->name); bus->priv = info; diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 8de129dc83..a42f3eca33 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -168,7 +168,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc, printf("can't get the IVM_Boardid\n"); return 1; } - sprintf((char *)buf, "%s", p); + strcpy((char *)buf, p); setenv("boardid", (char *)buf); printf("set boardid=%s\n", buf); @@ -177,7 +177,7 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc, printf("can't get the IVM_HWKey\n"); return 1; } - sprintf((char *)buf, "%s", p); + strcpy((char *)buf, p); setenv("hwkey", (char *)buf); printf("set hwkey=%s\n", buf); printf("Execute manually saveenv for persistent storage.\n"); diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c index 6b96bd526e..226217570c 100644 --- a/board/mpl/common/common_util.c +++ b/board/mpl/common/common_util.c @@ -698,12 +698,12 @@ void video_get_info_str (int line_number, char *info) s=getenv ("serial#"); #ifdef CONFIG_PIP405 if (!s || strncmp (s, "PIP405", 6)) { - sprintf(buf,"### No HW ID - assuming PIP405"); + strcpy(buf,"### No HW ID - assuming PIP405"); } #endif #ifdef CONFIG_MIP405 if (!s || strncmp (s, "MIP405", 6)) { - sprintf(buf,"### No HW ID - assuming MIP405"); + strcpy(buf,"### No HW ID - assuming MIP405"); } #endif else { @@ -718,7 +718,7 @@ void video_get_info_str (int line_number, char *info) } buf[i++] = *s; } - sprintf(&buf[i]," SN "); + strcpy(&buf[i]," SN "); i+=4; for (; s < e; ++s) { buf[i++] = *s; @@ -744,7 +744,7 @@ void video_get_info_str (int line_number, char *info) ctfb.modeIdent); return; case 1: - sprintf (buf, "%s",CONFIG_IDENT_STRING); + strcpy(buf, CONFIG_IDENT_STRING); sprintf (info, " %s", &buf[1]); return; } diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index c25b486f4a..426ae14af2 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -355,10 +355,10 @@ int exynos_init(void) } /* Request soft I2C gpios */ - sprintf(buf, "soft_i2c_scl"); + strcpy(buf, "soft_i2c_scl"); gpio_request(CONFIG_SOFT_I2C_GPIO_SCL, buf); - sprintf(buf, "soft_i2c_sda"); + strcpy(buf, "soft_i2c_sda"); gpio_request(CONFIG_SOFT_I2C_GPIO_SDA, buf); check_hw_revision(); diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index f94e3e5736..b3c666c054 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -480,7 +480,7 @@ int board_late_init(void) sprintf(tmp, "%s_%s", factory_dat.asn, factory_dat.comp_version); else - sprintf(tmp, "QMX7.E38_4.0"); + strcpy(tmp, "QMX7.E38_4.0"); ret = setenv("boardid", tmp); if (ret) diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c index 638d14f6d0..ac44e32341 100644 --- a/board/vscom/baltos/board.c +++ b/board/vscom/baltos/board.c @@ -346,7 +346,7 @@ int board_late_init(void) /* get production data */ if (read_eeprom(&header)) { - sprintf(model, "211"); + strcpy(model, "211"); } else { sprintf(model, "%d", header.SystemId); if (header.SystemId == 215) { -- cgit v1.2.1