[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xenalyze: correct symbol name length fscanf() specifier


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Mon, 28 Jul 2025 19:08:46 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gefHANxxVieKdHAu5lbbcO80Zxn6z7e5gI0jN68l0dc=; b=RRoaNL8kVx5qbLhoxLE4NjxN1yn8GWv8IhRBB0F6V6XX9ONv3P00mNZxMgCFxhVAvhtgJ62bgck/XCKWsPELTa0vmOMAXz2C5V2vv9Lg8R325QEFJhFzQ2zXFclK4RgFKm7dqI2QMmdnftt0lPRbSVjid1Xzy2UK6GcnNbmPhpEFXdvvQzXjiIy04saofMkK4C1PNMyfAGM+sV5EPZaY0YI+UDwKYwmI5v64qgAMK5VNeubgThG+cWQ6+Uw2ft2xoy8zxJeu1CjczdZPXE77g7ugcKfcuyI0LZ2bIPbIXdyBUkZC/g94bAWl4GpGhnz/eGr2DtDI8aV8Iw0CWaVphg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VChfLeFsq+BuzwvRBx5SQvS5OHEP1bWdCH0a9zj9xwI9QeIdl5/jH8Vp32qXrkLDFLjXcGDftnnr2JXiKUuc8xduPbYGKmQFOopyqUa+51j9ZSGukmxmFeQH6aUZoWK568mtB6jiN7KwX37xCFtFBn5D0yAdwfEf2FhNTL4Eg6AWfDbiGApQpAIwzzv1m7v6n1Sneg+BvEfNd6fz2IzrHce6TxmHR+gztyOssWicx71gJ0VHGy5C97AS7G2S69kDq2StDuJlHj30enZ2SnEVOjfcRR8y7Y3H2uET0jreDQLRb7qEOTaZ99qiFgbMWwQjnzOep/BJwJf9uJgLvo9pYg==
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 28 Jul 2025 17:08:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>
> ---
> 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@xxxxxxx>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.