Skip to contentSkip to conversation

xentrace: free CPU mask string before overwriting pointer

PATCH In review Jan Beulich 4 participants 4 messages Jan 14, 2025 – Jan 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xentrace: free CPU mask string before overwriting pointer

While multiple -c options may be unexpected, we'd still better deal with them properly.

Also restore the blank line that was bogusly zapped by the same commit.

Coverity-ID: 1638723

Fixes e4ad2836842a ("xentrace: Implement cpu mask range parsing of human values (-c)")
tools/xentrace/xentrace.c +2 -0
@@ -1105,8 +1105,10 @@ static void parse_args(int argc, char **
             break;
 
         case 'c': /* set new cpu mask for filtering (when xch is set). */
+            free(opts.cpu_mask_str);
             opts.cpu_mask_str = strdup(optarg);
             break;
+
         case 'e': /* set new event mask for filtering*/
             parse_evtmask(optarg);
             break;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

While multiple -c options may be unexpected, we'd still better deal with them properly.

Also restore the blank line that was bogusly zapped by the same commit.

Coverity-ID: 1638723

Fixes e4ad2836842a ("xentrace: Implement cpu mask range parsing of human values (-c)")
#2 lore raw
In reply to Jan Beulich
Quoted 8 lines · Jan Beulich

While multiple -c options may be unexpected, we'd still better deal with them properly.

Also restore the blank line that was bogusly zapped by the same commit.

Coverity-ID: 1638723

Fixes e4ad2836842a ("xentrace: Implement cpu mask range parsing of human values (-c)")

Thanks.

~ Oleksii

Quoted 14 lines
tools/xentrace/xentrace.c +2 -0
@@ -1105,8 +1105,10 @@ static void parse_args(int argc, char **
              break;
 
          case 'c': /* set new cpu mask for filtering (when xch is set). */
+            free(opts.cpu_mask_str);
              opts.cpu_mask_str = strdup(optarg);
              break;
+
          case 'e': /* set new event mask for filtering*/
              parse_evtmask(optarg);
              break;
Acked-by on v1 1/1
#3 lore raw
In reply to Jan Beulich
Quoted 8 lines · Jan Beulich

While multiple -c options may be unexpected, we'd still better deal with them properly.

Also restore the blank line that was bogusly zapped by the same commit.

Coverity-ID: 1638723

Fixes e4ad2836842a ("xentrace: Implement cpu mask range parsing of human values (-c)")

Thanks,

Signature · 5 lines
 | Vates 

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech