[PATCH v4 1/2] power: introduce PM QoS API on CPU wide

Stephen Hemminger stephen at networkplumber.org
Thu Jun 27 17:06:51 CEST 2024


On Thu, 27 Jun 2024 14:00:10 +0800
Huisong Li <lihuisong at huawei.com> wrote:

> +	char buf[BUFSIZ] = {0};

BUFSIZ is 4K and you probably don't need all of that.
And initializing to 0 here should not be needed.

Why not:
	char buf[LINE_MAX];

> +	if (latency == 0)
> +		sprintf(buf, "%s", "n/a");
> +	else if (latency == RTE_POWER_QOS_RESUME_LATENCY_NO_CONSTRAINT)
> +		sprintf(buf, "%u", 0);
> +	else
> +		sprintf(buf, "%u", latency);

Use snprintf instead.


More information about the dev mailing list