[v8 1/8] bus/dpaa: add FMan node
Stephen Hemminger
stephen at networkplumber.org
Fri Jul 11 00:37:40 CEST 2025
On Thu, 3 Jul 2025 11:07:36 +0530
vanshika.shukla at nxp.com wrote:
>
> /* Create device name */
> memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN);
> - if (fman_intf->mac_type == fman_offline_internal)
> + if (fman_intf->mac_type == fman_offline_internal) {
> sprintf(dev->name, "fm%d-oh%d",
> - (fman_intf->fman_idx + 1), fman_intf->mac_idx);
> - else if (fman_intf->mac_type == fman_onic)
> + (fman_intf->fman->idx + 1), fman_intf->mac_idx);
> + } else if (fman_intf->mac_type == fman_onic) {
> sprintf(dev->name, "fm%d-onic%d",
> - (fman_intf->fman_idx + 1), fman_intf->mac_idx);
> - else
> + (fman_intf->fman->idx + 1), fman_intf->mac_idx);
> + } else {
> sprintf(dev->name, "fm%d-mac%d",
> - (fman_intf->fman_idx + 1), fman_intf->mac_idx);
> + (fman_intf->fman->idx + 1), fman_intf->mac_idx);
> + }
Your patch is ok. But using sprintf to create device name is a potential bug trap
since it could over run the device name. Please use snprintf instead.
More information about the dev
mailing list