[dpdk-stable] [PATCH] eal: don't log uninitialized string

David Marchand david.marchand at redhat.com
Wed Jan 6 10:35:13 CET 2021


On Fri, Dec 11, 2020 at 6:07 PM Andrew Boyer <aboyer at pensando.io> wrote:
>
> Our Coverity scan pointed out that path[] is never initialized.
> The official DPDK Coverity has not reported this so there is
> no public CID for it.
>
> Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")
> Cc: anatoly.burakov at intel.com
> Cc: stable at dpdk.org
>
> Signed-off-by: Andrew Boyer <aboyer at pensando.io>
> ---
>  lib/librte_eal/common/eal_common_fbarray.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
> index 1220e2bae..6ce89af83 100644
> --- a/lib/librte_eal/common/eal_common_fbarray.c
> +++ b/lib/librte_eal/common/eal_common_fbarray.c
> @@ -83,11 +83,10 @@ get_used_mask(void *data, unsigned int elt_sz, unsigned int len)
>  static int
>  resize_and_map(int fd, void *addr, size_t len)
>  {
> -       char path[PATH_MAX];
>         void *map_addr;
>
>         if (eal_file_truncate(fd, len)) {
> -               RTE_LOG(ERR, EAL, "Cannot truncate %s\n", path);
> +               RTE_LOG(ERR, EAL, "Cannot truncate fd %d\n", fd);

Logging a fd number won't help much, but I guess this was not really
helpful with path[] either :-).
If we keep this log, I would move it to the callers of the functions,
where the filename is available.


-- 
David Marchand



More information about the stable mailing list