From: Aaron Conole <aconole@redhat.com>
To: Pallantla Poornima <pallantlax.poornima@intel.com>
Cc: dev@dpdk.org, reshma.pattan@intel.com, david.hunt@intel.com,
stable@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] power: fix sprintf with snprintf
Date: Fri, 08 Feb 2019 16:28:51 -0500 [thread overview]
Message-ID: <f7tk1iadl64.fsf@dhcp-25.97.bos.redhat.com> (raw)
In-Reply-To: <1549265096-4812-1-git-send-email-pallantlax.poornima@intel.com> (Pallantla Poornima's message of "Mon, 4 Feb 2019 07:24:56 +0000")
Pallantla Poornima <pallantlax.poornima@intel.com> writes:
> sprintf function is not secure as it doesn't check the length of string.
> More secure function snprintf is used.
>
> Fixes: 450f079131 ("power: add traffic pattern aware power control")
> Cc: stable@dpdk.org
>
> Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
> ---
> lib/librte_power/rte_power_empty_poll.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/librte_power/rte_power_empty_poll.c b/lib/librte_power/rte_power_empty_poll.c
> index e6145462f..df00a3968 100644
> --- a/lib/librte_power/rte_power_empty_poll.c
> +++ b/lib/librte_power/rte_power_empty_poll.c
> @@ -159,7 +159,7 @@ update_training_stats(struct priority_worker *poll_stats,
> char pfi_str[32];
> uint64_t p0_empty_deq;
>
> - sprintf(pfi_str, "%02d", freq);
> + snprintf(pfi_str, sizeof(pfi_str), "%02d", freq);
Shouldn't we just remove pfi_str completely? I don't see it referenced
anywhere else in this function.
That would be better than changing to snprintf(), imo.
> if (poll_stats->cur_freq == freq &&
> poll_stats->thresh[freq].trained == false) {
prev parent reply other threads:[~2019-02-08 21:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-04 7:24 Pallantla Poornima
2019-02-08 21:28 ` Aaron Conole [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7tk1iadl64.fsf@dhcp-25.97.bos.redhat.com \
--to=aconole@redhat.com \
--cc=david.hunt@intel.com \
--cc=dev@dpdk.org \
--cc=pallantlax.poornima@intel.com \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).