All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xenalyze: correct symbol name length fscanf() specifier
@ 2025-07-28 15:52 Jan Beulich
  2025-07-28 17:08 ` Alejandro Vallejo
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2025-07-28 15:52 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org; +Cc: Anthony PERARD

SYMBOL_NAME_SIZE is 124, not 128. Use the symbolic name there as well,
to avoid any disconnect.

While there correct indentation on the following line as well.

Coverity ID: 1659391
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
There's no useful Fixes: tag; the code was imported from HG this way
about 10 years ago.

--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -321,11 +321,10 @@ void parse_symbol_file(char *fn) {
             (*p)->next=NULL;
         }
 
-        /* FIXME -- use SYMBOL_NAME_SIZE */
         /* FIXME -- use regexp.  This won't work for symbols with spaces (yes they exist) */
         (*p)->symbols[(*p)->count].addr = 0xDEADBEEF;
-        if ( fscanf(symbol_file, "%llx %128s",
-               &(*p)->symbols[(*p)->count].addr,
+        if ( fscanf(symbol_file, "%llx %" STR(SYMBOL_NAME_SIZE) "s",
+                    &(*p)->symbols[(*p)->count].addr,
                     (*p)->symbols[(*p)->count].name) == 0 )
             break;
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xenalyze: correct symbol name length fscanf() specifier
  2025-07-28 15:52 [PATCH] xenalyze: correct symbol name length fscanf() specifier Jan Beulich
@ 2025-07-28 17:08 ` Alejandro Vallejo
  2025-07-31  9:37   ` Anthony PERARD
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Vallejo @ 2025-07-28 17:08 UTC (permalink / raw)
  To: Jan Beulich, xen-devel@lists.xenproject.org; +Cc: Anthony PERARD, Xen-devel

On Mon Jul 28, 2025 at 5:52 PM CEST, Jan Beulich wrote:
> SYMBOL_NAME_SIZE is 124, not 128. Use the symbolic name there as well,
> to avoid any disconnect.
>
> While there correct indentation on the following line as well.
>
> Coverity ID: 1659391
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
> There's no useful Fixes: tag; the code was imported from HG this way
> about 10 years ago.
>
> --- a/tools/xentrace/xenalyze.c
> +++ b/tools/xentrace/xenalyze.c
> @@ -321,11 +321,10 @@ void parse_symbol_file(char *fn) {
>              (*p)->next=NULL;
>          }
>  
> -        /* FIXME -- use SYMBOL_NAME_SIZE */
>          /* FIXME -- use regexp.  This won't work for symbols with spaces (yes they exist) */
>          (*p)->symbols[(*p)->count].addr = 0xDEADBEEF;
> -        if ( fscanf(symbol_file, "%llx %128s",
> -               &(*p)->symbols[(*p)->count].addr,
> +        if ( fscanf(symbol_file, "%llx %" STR(SYMBOL_NAME_SIZE) "s",

nit: A comment at the #define stating it's used this way would prevent future
"oops" situations when/if someone tries to do (e.g) "#define SYMBOL_NAME_SIZE (1
<< 4)"

Though arguably that would cause a compile-time error anyway (except perhaps
an octal literal?), so meh. With or without the adjustment:

  Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>

> +                    &(*p)->symbols[(*p)->count].addr,
>                      (*p)->symbols[(*p)->count].name) == 0 )
>              break;
>  



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xenalyze: correct symbol name length fscanf() specifier
  2025-07-28 17:08 ` Alejandro Vallejo
@ 2025-07-31  9:37   ` Anthony PERARD
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony PERARD @ 2025-07-31  9:37 UTC (permalink / raw)
  To: Alejandro Vallejo, Jan Beulich
  Cc: xen-devel@lists.xenproject.org, Anthony PERARD, Xen-devel

On Mon, Jul 28, 2025 at 07:08:46PM +0200, Alejandro Vallejo wrote:
> On Mon Jul 28, 2025 at 5:52 PM CEST, Jan Beulich wrote:
> > SYMBOL_NAME_SIZE is 124, not 128. Use the symbolic name there as well,
> > to avoid any disconnect.
> >
> > While there correct indentation on the following line as well.
> >
> > Coverity ID: 1659391
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > ---
> > There's no useful Fixes: tag; the code was imported from HG this way
> > about 10 years ago.
> >
> > --- a/tools/xentrace/xenalyze.c
> > +++ b/tools/xentrace/xenalyze.c
> > @@ -321,11 +321,10 @@ void parse_symbol_file(char *fn) {
> >              (*p)->next=NULL;
> >          }
> >  
> > -        /* FIXME -- use SYMBOL_NAME_SIZE */
> >          /* FIXME -- use regexp.  This won't work for symbols with spaces (yes they exist) */
> >          (*p)->symbols[(*p)->count].addr = 0xDEADBEEF;
> > -        if ( fscanf(symbol_file, "%llx %128s",
> > -               &(*p)->symbols[(*p)->count].addr,
> > +        if ( fscanf(symbol_file, "%llx %" STR(SYMBOL_NAME_SIZE) "s",
> 
> nit: A comment at the #define stating it's used this way would prevent future
> "oops" situations when/if someone tries to do (e.g) "#define SYMBOL_NAME_SIZE (1
> << 4)"
> 
> Though arguably that would cause a compile-time error anyway (except perhaps
> an octal literal?), so meh. With or without the adjustment:
> 
>   Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>

Acked-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-31  9:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-28 15:52 [PATCH] xenalyze: correct symbol name length fscanf() specifier Jan Beulich
2025-07-28 17:08 ` Alejandro Vallejo
2025-07-31  9:37   ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.