From: Michal Simek Date: Thu, 21 Jul 2022 14:19:18 +0000 (+0200) Subject: xilinx: common: Use strlcpy instead of strncpy X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=4a1bfcd7aa6f2138a8431a916d4202a66ab65a6c;p=u-boot.git xilinx: common: Use strlcpy instead of strncpy It is recommendation done by checkpatch to all the time have \0 terminated strings. Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/c7bfab50c40f6213f1b347b5e4674e382e83cb94.1658413156.git.michal.simek@amd.com --- diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index b0c11aaa42..9b4aded466 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -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) {