xilinx: zynqmp: Replace strncat with strlcat
Replace strncat with strlcat to always produce a valid null-terminated string. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Link: https://lore.kernel.org/r/20220620163650.18756-3-stefan.herbrechtsmeier-oss@weidmueller.com Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
parent
f851be15f4
commit
bcf6f71bd7
@ -282,13 +282,13 @@ static char *zynqmp_get_silicon_idcode_name(void)
|
|||||||
*/
|
*/
|
||||||
switch (family) {
|
switch (family) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
strncat(name, "ev", 2);
|
strlcat(name, "ev", sizeof(name));
|
||||||
break;
|
break;
|
||||||
case 0x10:
|
case 0x10:
|
||||||
strncat(name, "eg", 2);
|
strlcat(name, "eg", sizeof(name));
|
||||||
break;
|
break;
|
||||||
case 0x11:
|
case 0x11:
|
||||||
strncat(name, "cg", 2);
|
strlcat(name, "cg", sizeof(name));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Do not append family name*/
|
/* Do not append family name*/
|
||||||
@ -300,16 +300,17 @@ static char *zynqmp_get_silicon_idcode_name(void)
|
|||||||
* read. So, ignore the bit and just findout if it is CG
|
* read. So, ignore the bit and just findout if it is CG
|
||||||
* or EG/EV variant.
|
* or EG/EV variant.
|
||||||
*/
|
*/
|
||||||
strncat(name, (idcode2 & EFUSE_GPU_DIS_MASK) ? "cg" :
|
strlcat(name, (idcode2 & EFUSE_GPU_DIS_MASK) ? "cg" :
|
||||||
"e", 2);
|
"e", sizeof(name));
|
||||||
}
|
}
|
||||||
} else if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_CG) {
|
} else if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_CG) {
|
||||||
/* Devices with CG variant might be EG or CG family */
|
/* Devices with CG variant might be EG or CG family */
|
||||||
strncat(name, (idcode2 & EFUSE_GPU_DIS_MASK) ? "cg" : "eg", 2);
|
strlcat(name, (idcode2 & EFUSE_GPU_DIS_MASK) ? "cg" : "eg",
|
||||||
|
sizeof(name));
|
||||||
} else if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_EG) {
|
} else if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_EG) {
|
||||||
strncat(name, "eg", 2);
|
strlcat(name, "eg", sizeof(name));
|
||||||
} else if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_DR) {
|
} else if (zynqmp_devices[i].variants & ZYNQMP_VARIANT_DR) {
|
||||||
strncat(name, "dr", 2);
|
strlcat(name, "dr", sizeof(name));
|
||||||
} else {
|
} else {
|
||||||
debug("Variant not identified\n");
|
debug("Variant not identified\n");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user