diff options
author | Rolf Eike Beer <eb@emlix.com> | 2018-10-10 16:04:31 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2018-11-29 10:48:12 +0100 |
commit | 75d2637cbec81401d37305767939d53d9f409559 (patch) | |
tree | dd61beb978557eba1c0235447473ea0a624604bd /arch | |
parent | a05b96fea9971f3648b53824d97ccddb1a197267 (diff) |
Tegra: fix potential one byte overflows when calling strncpy()
Causes build failures with gcc 8.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/devices.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra_emc_dt_parse.c | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c index 3b2665de9326..7d9c4220bc1f 100644 --- a/arch/arm/mach-tegra/devices.c +++ b/arch/arm/mach-tegra/devices.c @@ -2005,8 +2005,7 @@ void tegra_smmu_map_misc_device(struct device *dev) { struct dma_iommu_mapping *map = smmu_default_map[SYSTEM_PROTECTED].map; if (!strncmp(dummy_name, DUMMY_DEV_NAME, strlen(dummy_name))) { - strncpy(dummy_name, dev_name(dev), - DUMMY_DEV_MAX_NAME_SIZE); + strlcpy(dummy_name, dev_name(dev), sizeof(dummy_name)); arm_iommu_attach_device(dev, map); dev_info(dev, "Mapped the misc device\n"); return; diff --git a/arch/arm/mach-tegra/tegra_emc_dt_parse.c b/arch/arm/mach-tegra/tegra_emc_dt_parse.c index 001f2f429c88..670109457609 100644 --- a/arch/arm/mach-tegra/tegra_emc_dt_parse.c +++ b/arch/arm/mach-tegra/tegra_emc_dt_parse.c @@ -109,7 +109,8 @@ void *tegra_emc_dt_parse_pdata_comp(const char *emc_mode, continue; } #if defined(CONFIG_ARCH_TEGRA_12x_SOC) - strncpy(tables[i].src_name, source_name, 16); + strlcpy(tables[i].src_name, source_name, + sizeof(tables[i].src_name)); #else tables[i].src_name = source_name; #endif @@ -253,8 +254,8 @@ void *tegra_emc_dt_parse_pdata_comp(const char *emc_mode, iter->full_name); continue; } - strncpy(tables[i].table_id, dvfs_ver, - TEGRA12_MAX_TABLE_ID_LEN); + strlcpy(tables[i].table_id, dvfs_ver, + sizeof(tables[i].table_id)); ret = of_property_read_u32(iter, "nvidia,gk20a-min-mv", &u); |