Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bus: fsl-mc: Use strscpy() instead of strscpy_pad()

Both destination buffers are already zero-initialized, making strscpy()
sufficient for safely copying 'obj_type'. The additional NUL-padding
performed by strscpy_pad() is unnecessary.

If the destination buffer has a fixed length, strscpy() automatically
determines its size using sizeof() when the argument is omitted. This
makes the explicit size arguments unnecessary.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20250429104149.66334-1-thorsten.blum@linux.dev
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

authored by

Thorsten Blum and committed by
Christophe Leroy
61ddf5fa 5ddac92b

+2 -2
+2 -2
drivers/bus/fsl-mc/dprc.c
··· 489 489 cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr); 490 490 cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num); 491 491 cmd_params->obj_id = cpu_to_le32(obj_id); 492 - strscpy_pad(cmd_params->obj_type, obj_type, 16); 492 + strscpy(cmd_params->obj_type, obj_type); 493 493 494 494 /* send command to mc*/ 495 495 return mc_send_command(mc_io, &cmd); ··· 561 561 cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params; 562 562 cmd_params->obj_id = cpu_to_le32(obj_id); 563 563 cmd_params->region_index = region_index; 564 - strscpy_pad(cmd_params->obj_type, obj_type, 16); 564 + strscpy(cmd_params->obj_type, obj_type); 565 565 566 566 /* send command to mc*/ 567 567 err = mc_send_command(mc_io, &cmd);