diff mbox series

xentrace: free CPU mask string before overwriting pointer

Message ID fedf2b9d-a475-4062-b8a4-5e33c7dd6305@suse.com (mailing list archive)
State New
Headers show
Series xentrace: free CPU mask string before overwriting pointer | expand

Commit Message

Jan Beulich Jan. 14, 2025, 8:12 a.m. UTC
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)")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Andrew Cooper Jan. 14, 2025, 9:28 a.m. UTC | #1
On 14/01/2025 8:12 am, Jan Beulich wrote:
> 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)")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Oleksii Kurochko Jan. 14, 2025, 11:24 a.m. UTC | #2
On 1/14/25 9:12 AM, Jan Beulich wrote:
> 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)")
> Signed-off-by: Jan Beulich<jbeulich@suse.com>

R-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii

>
> --- a/tools/xentrace/xentrace.c
> +++ b/tools/xentrace/xentrace.c
> @@ -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;
diff mbox series

Patch

--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -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;