MLK-12181 misc: at25: Cleaning up missing null-terminate in conjunction with strncpy
authorFugang Duan <b38611@freescale.com>
Mon, 11 Jan 2016 08:10:10 +0000 (16:10 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:43 +0000 (14:49 -0500)
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.

Signed-off-by: Fugang Duan <B38611@freescale.com>
drivers/misc/eeprom/at25.c

index 5afe4cd..67eb81a 100644 (file)
@@ -249,7 +249,7 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
        u32 val;
 
        memset(chip, 0, sizeof(*chip));
-       strncpy(chip->name, "at25", sizeof(chip->name));
+       strlcpy(chip->name, "at25", sizeof(chip->name));
 
        if (device_property_read_u32(dev, "size", &val) == 0 ||
            device_property_read_u32(dev, "at25,byte-len", &val) == 0) {