]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
xilinx: common: Use strlcpy instead of strncpy
authorMichal Simek <michal.simek@amd.com>
Thu, 21 Jul 2022 14:19:18 +0000 (16:19 +0200)
committerMichal Simek <michal.simek@amd.com>
Tue, 26 Jul 2022 06:25:16 +0000 (08:25 +0200)
It is recommendation done by checkpatch to all the time have \0 terminated
strings.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/c7bfab50c40f6213f1b347b5e4674e382e83cb94.1658413156.git.michal.simek@amd.com
board/xilinx/common/board.c

index b0c11aaa4256d610ea0f9790fad464717672edd5..9b4aded466abfb056704d132aa761448b68a62d1 100644 (file)
@@ -238,23 +238,23 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
        }
 
        /* It is clear that FRU was captured and structures were filled */
-       strncpy(desc->manufacturer, (char *)fru_data.brd.manufacturer_name,
+       strlcpy(desc->manufacturer, (char *)fru_data.brd.manufacturer_name,
                sizeof(desc->manufacturer));
-       strncpy(desc->uuid, (char *)fru_data.brd.uuid,
+       strlcpy(desc->uuid, (char *)fru_data.brd.uuid,
                sizeof(desc->uuid));
-       strncpy(desc->name, (char *)fru_data.brd.product_name,
+       strlcpy(desc->name, (char *)fru_data.brd.product_name,
                sizeof(desc->name));
        for (i = 0; i < sizeof(desc->name); i++) {
                if (desc->name[i] == ' ')
                        desc->name[i] = '\0';
        }
-       strncpy(desc->revision, (char *)fru_data.brd.rev,
+       strlcpy(desc->revision, (char *)fru_data.brd.rev,
                sizeof(desc->revision));
        for (i = 0; i < sizeof(desc->revision); i++) {
                if (desc->revision[i] == ' ')
                        desc->revision[i] = '\0';
        }
-       strncpy(desc->serial, (char *)fru_data.brd.serial_number,
+       strlcpy(desc->serial, (char *)fru_data.brd.serial_number,
                sizeof(desc->serial));
 
        while (id < EEPROM_HDR_NO_OF_MAC_ADDR) {