aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/kinetis.c
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2018-05-22 12:04:31 +0300
committerMatthias Welwarsky <matthias@welwarsky.de>2018-05-30 09:36:46 +0100
commitb50fa9a19d0b600d26b6cbca57cd94c7b89f941c (patch)
treeb877109bddff78d9e6594edf70de5f457d5203cc /src/flash/nor/kinetis.c
parentdae1ec1278fcac5369843b52db5eb12c2180d624 (diff)
downloadriscv-openocd-b50fa9a19d0b600d26b6cbca57cd94c7b89f941c.zip
riscv-openocd-b50fa9a19d0b600d26b6cbca57cd94c7b89f941c.tar.gz
riscv-openocd-b50fa9a19d0b600d26b6cbca57cd94c7b89f941c.tar.bz2
Fix warnings exposed by GCC8
gcc (GCC) 8.1.0 generates new warnings and thus fails the build. The ARM disassembler warnings actually exposed a bug in SMALW, SMULW and SMUL instructions decoding. Reported by Eimers on IRC. Change-Id: I200c70f75a9e07a1f13a592addc1c5fb37714440 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4526 Tested-by: jenkins Reviewed-by: Jiri Kastner <cz172638@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Diffstat (limited to 'src/flash/nor/kinetis.c')
-rw-r--r--src/flash/nor/kinetis.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index 4d665d3..86fad72 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -937,7 +937,7 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
unsigned num_blocks;
struct kinetis_flash_bank *k_bank;
struct flash_bank *bank;
- char base_name[80], name[80], num[4];
+ char base_name[69], name[80], num[4];
char *class, *p;
num_blocks = k_chip->num_pflash_blocks + k_chip->num_nvm_blocks;
@@ -948,7 +948,8 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
bank = k_chip->banks[0].bank;
if (bank && bank->name) {
- strncpy(base_name, bank->name, sizeof(base_name));
+ strncpy(base_name, bank->name, sizeof(base_name) - 1);
+ base_name[sizeof(base_name) - 1] = '\0';
p = strstr(base_name, ".pflash");
if (p) {
*p = '\0';
@@ -960,7 +961,8 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
}
}
} else {
- strncpy(base_name, target_name(k_chip->target), sizeof(base_name));
+ strncpy(base_name, target_name(k_chip->target), sizeof(base_name) - 1);
+ base_name[sizeof(base_name) - 1] = '\0';
p = strstr(base_name, ".cpu");
if (p)
*p = '\0';
@@ -2012,7 +2014,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
unsigned cpu_mhz = 120;
unsigned idx;
bool use_nvm_marking = false;
- char flash_marking[11], nvm_marking[2];
+ char flash_marking[12], nvm_marking[2];
char name[40];
k_chip->probed = false;