From nobody Sat Dec 28 03:57:56 2024 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 082311E9B3C for ; Wed, 11 Dec 2024 08:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733907359; cv=none; b=HjnFII2DYLVUyR+RoTYUr1DCM1A+k4CTr1cNZT39naUXyivSQOUE6H2AGn7tTvJz9PTmjUn2dm0CZq1z53Xa7DGmaN5eYcDtW89k1GkeNnIzLjvWGVZHPddEjcGWmhB0+G+QJStsADAwal+RpNu1M7/uhthNSrdkZKi2Ao20lSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733907359; c=relaxed/simple; bh=jU2cTye6u+MqjljYXpav0xuajR01RvYb2NHvhER20GM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lIsa/Yi09s8Qm2QVEskD/7zfBrbPPPKkFUT7slhuf72m4pdIUhUvdhTVnH7wZgiVhffzIoNWq0GHQgMyW6Gthj0FcYGUlrPRJjdQzHP2Kl9/Dc0Oy3PCSREr7PdSC0XqNL9gOulhgthRBbgzVw233UtGEQE2a4flDLiR3/OtwEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=NJZIZlWN; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NJZIZlWN" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4361ecebc4dso1694625e9.0 for ; Wed, 11 Dec 2024 00:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733907356; x=1734512156; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hcHQmIuxvuepl+FXqoONmaD12Al+psUsKwLo0YRh2mU=; b=NJZIZlWNYqOiSgjbqzuh6QzfZ12zqaWvN3cJoB7mqGcn+6W0KGd0TV9aU69ezJMMMM xbC2Zv6ExScE40T5/nIhbi0gVp7qsieXwJF0Gm8gxcdm2eJ9VF8QBL6JqlKKsvmtpCd+ mwMY6ZTou+gBhH4InjQe+1QDxhfxUNUjxz6sXTtO+7KjK8e5yzkDfykydzi3LojRisI6 7NDWdRI+t61bY3ZdQOhMqRugKpDQcmV4A0jPpwkwMzeKdHA7B/OD+v61cAqZNcy0a3SX tLiOvnbOr4ExCPXNmwRP4rNgeBrCZMMY/pk2euwNNJgkkq1wpSEDRF5HtifdpnDcIRGy B8sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733907356; x=1734512156; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hcHQmIuxvuepl+FXqoONmaD12Al+psUsKwLo0YRh2mU=; b=njH81j8hpyp3yl0XjMF3IewbzyGuZcV1dq3jwRYlGHs4w33aK0FPX4qKjRS58XlL9M lSI5mGTYuOC5EAKHTedSNhW/uWfFBYtudJZFRB5ETSv7k9qIvd5G3CJ0mjmvDvoISfnd f+wtAws260Cv7HErHeYTBA2TuH20od8JQ+S2iNjJXQj4gdVWJ3SkpPOZezvoK4hXhcpN kWTm+I1N03FZXqwuVWwKgSX/LFMiy+Wk0VlWNsGc7kVH+Uc+TWR767C1ZikkzMISbYYs lmqQiDVm5VCfpKg50A0KxzU8VssHbnrfp81jaY61LQzRZ88j+2IlFxbbzU+Int1aK0zw sWBQ== X-Forwarded-Encrypted: i=1; AJvYcCWqjl6qkSGFyqidstvI6PxBuFAiR3D183JrCx734lvLwT2gu+VGMSidn8f4a8x4+APwCsgn0LGikyn4Bug=@vger.kernel.org X-Gm-Message-State: AOJu0YydadDM51mzUoGySZNu7Na6crv98R0PTT5ffjYZiAWCJFOMuXUm APr1qMIjBadG9gP0GM6zrTiH+OfRTgJLU880tnTR6XGq0oRMuPqkC/Mk7nMj250= X-Gm-Gg: ASbGnctQ6cgO7B/m20YK4WO5tQU91LPRxKUR8kZrg91D9kIjA6JSwYf4ZChCinjCSw+ EQh11JrC0GDnQ8XnxNmE8Rahn6sZDqjxKJo2iO9SM95wN6rbUnIO+Oo5LprEAxgAtwwgCOE6oL3 Cl5DARaaovfxZeOVcb45GIwcSCjPDWjDQ2ccP3OWN1GjeMZ4UnxynQXqz76lkaJ2XcHDsq6Aw2E VT/bG0wcFjKe2kYwclS7vHFBEqg8uCe03KLlbsS9aVFApoqByuXJ+A= X-Google-Smtp-Source: AGHT+IEIfgzMHSJgClgRVEQhxy9voa2z51hrr/ck8y11zNHvU33CoGimomwfzx17Egq7xD4wppeDWA== X-Received: by 2002:a05:600c:3108:b0:434:f953:eed with SMTP id 5b1f17b1804b1-4361c4406bdmr14985805e9.30.1733907356354; Wed, 11 Dec 2024 00:55:56 -0800 (PST) Received: from pop-os.. ([209.198.129.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d52cbd72sm257204185e9.44.2024.12.11.00.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 00:55:55 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org, namhyung@kernel.org, acme@kernel.org, mhiramat@kernel.org Cc: James Clark , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Leo Yan , Dima Kogan , "Dr. David Alan Gilbert" , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] perf probe: Fix uninitialized variable Date: Wed, 11 Dec 2024 08:55:23 +0000 Message-Id: <20241211085525.519458-2-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211085525.519458-1-james.clark@linaro.org> References: <20241211085525.519458-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since the linked fixes: commit, err is returned uninitialized due to the removal of "return 0". Initialize err to fix it. This fixes the following intermittent test failure on release builds: $ perf test "testsuite_probe" ... -- [ FAIL ] -- perf_probe :: test_invalid_options :: mutually exclusive op= tions :: -L foo -V bar (output regexp parsing) Regexp not found: \"Error: switch .+ cannot be used with switch .+\" ... Fixes: 080e47b2a237 ("perf probe: Introduce quotation marks support") Tested-by: Namhyung Kim Reviewed-by: Arnaldo Carvalho de Melo Acked-by: Masami Hiramatsu (Google) Signed-off-by: James Clark --- tools/perf/util/probe-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 6d51a4c98ad7..eaa0318e9b87 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1370,7 +1370,7 @@ int parse_line_range_desc(const char *arg, struct lin= e_range *lr) { char *buf =3D strdup(arg); char *p; - int err; + int err =3D 0; =20 if (!buf) return -ENOMEM; --=20 2.34.1 From nobody Sat Dec 28 03:57:56 2024 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 443511EC4DA for ; Wed, 11 Dec 2024 08:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733907362; cv=none; b=BvBxFOZyXmLUfOGcOa4hweYMcgpV0L/VLD/j3rhatylVLWfv4WOWDAFBYC+ZcDHVL3ybHy7nQtkiY2Y4t4v5wRvsGNxAM9sGXjp09e/4pH4hZgFhUw5yT9STOkeVU8U049NUobEtlPXTO1Uf02mmqoRpFbJbfGfRtwPen8LWVhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733907362; c=relaxed/simple; bh=SHiag0Flwix2IL/7LkzmO5BJXZF9o/yMIBz5/KtMkQ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JBgqI8vMcQATABz5utCRq7tm04psozsaixhv0jIKNzlUSP8NQh6K5yl670UGH8bazL6Q51ENQc7aB1yTHprqtEzQp8Ag/DFwo9kKuMqJ+0j0qhY3m0e90yRCHdZZldNGL4x40arHt6uuP8OIrlg4MgU9b8m5zlYvRrtcUwsMQ5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=aqNZpfoM; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aqNZpfoM" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-435004228c0so24914735e9.0 for ; Wed, 11 Dec 2024 00:55:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733907358; x=1734512158; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iMCW/XO9o+mmi32R54QM1qNspZAsbttLauYO9rQfjbM=; b=aqNZpfoMJrcTjaYrdi4/JCNwQDBGmX1R/5VJdBcWzTCBFKrCm+gWvuadyVLgfUjs1z Ndqpk5jTda9M3UEjCXpZnTRDjgR/jhhL6K4it/BspyuDG3wutzfIU7GVR89CdeL6Q61w k+T6el3USsGAh0S9tAQBalYLJxK4qmra4dZiEcMESPMirhT9N6IPDMTMLKfuRMppqTbV aKnoZesbuhEUHd6MjXaABrQAG8RzqTH6SvTORfsJUonw37cEbVL6sAUitw5MtIlE9lwC IjA/k+5VzIY4isaVcxsnQ1OyRUKHvtkvk9zEKwcYxMfWaeNci7WzQxoP/wfaiswWdRSI utTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733907358; x=1734512158; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iMCW/XO9o+mmi32R54QM1qNspZAsbttLauYO9rQfjbM=; b=gM6Eym35GiPPfL2bnD53sNqfw9FV4H2SwD+o/R51I5xf2/gveQuLq1QMAwDHKTfkAp CyxRQYBk54o6vci37pJ32OarutmeJt3oN8JjoMtlMsk4efy311kxOs7nCWxn8UGq/2k2 CO5/zWRqCGewHN1H6qkf8Zs881kl2G7DRilVZlGc73pt8N01c5+pXL8PhONDNtnuJS7+ VQjuTQoaBTjTx0m+EiiqyT5umEAg+ZNIDgQ/dqDb7/bO9H8mlmzgA7xD+AxxuFMTn+RO J4YMhap1En4OBI7gJDoOf/oVfDkbU7e6GbCKII+/PK5fAHl47C68CYvSQUrDKY+bKR/b jjcg== X-Forwarded-Encrypted: i=1; AJvYcCU01D8iWAEirU2hlHfHF07K2dl2HFEWCxFFGi6AQbg5DkpNjIhpUSp7IkQdyEDRSw977hTO1VIBmoxFxFY=@vger.kernel.org X-Gm-Message-State: AOJu0YwTQY7C62+9ueUmnsepUJHh+ocfXpre/D6lPrHVdjHeRIy9mPdX UpaRIh/XCH/rFkR/V/Z/Kxl/BMpHspBJv9qvatb2EtWFU1muvvbJ03toX5FpHsM= X-Gm-Gg: ASbGncsMwWHkandut2z+9iG8Z9JBVFzMC8zBHpmdAYaQAHwzbwUZ5MfxgFxa7fDiIUA xOa8VqJHLbQqhwTOHWEdgQZZM1ytsHsp5fOwrUQsix/1Um6FtUASECOuN1hqbJMfW9mbwUfB9/G sr7DxeKTslOP+bZ8xi679kXHeaZNgCtWAulcFQbxZPA6oHSMY+9Q/iwMg+EBFTAEy4I4/ClJ2rO W+vhJIvbDcSx+Blvoy3lvwn63lGCr3MJn2iULf5uk8JJmBzeCg/MmU= X-Google-Smtp-Source: AGHT+IFXpwNlVA326/ez1WlH2MCgtyYBdzEE9ZmE3eSWrE0KHUhUUv+qurdmdnKSG7iuu4tiLtSwwA== X-Received: by 2002:a05:600c:3acf:b0:434:fddf:5c0c with SMTP id 5b1f17b1804b1-4361c393cc1mr14674875e9.4.1733907358562; Wed, 11 Dec 2024 00:55:58 -0800 (PST) Received: from pop-os.. ([209.198.129.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434d52cbd72sm257204185e9.44.2024.12.11.00.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 00:55:58 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org, namhyung@kernel.org, acme@kernel.org, mhiramat@kernel.org Cc: James Clark , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , "Liang, Kan" , Leo Yan , "Dr. David Alan Gilbert" , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] perf probe: Rename err label Date: Wed, 11 Dec 2024 08:55:24 +0000 Message-Id: <20241211085525.519458-3-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241211085525.519458-1-james.clark@linaro.org> References: <20241211085525.519458-1-james.clark@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename err to out to avoid confusion because buf is still supposed to be freed in non error cases. Tested-by: Namhyung Kim Reviewed-by: Arnaldo Carvalho de Melo Acked-by: Masami Hiramatsu (Google) Signed-off-by: James Clark --- tools/perf/util/probe-event.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index eaa0318e9b87..35af6570cf9b 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -1383,20 +1383,20 @@ int parse_line_range_desc(const char *arg, struct l= ine_range *lr) if (p =3D=3D buf) { semantic_error("No file/function name in '%s'.\n", p); err =3D -EINVAL; - goto err; + goto out; } *(p++) =3D '\0'; =20 err =3D parse_line_num(&p, &lr->start, "start line"); if (err) - goto err; + goto out; =20 if (*p =3D=3D '+' || *p =3D=3D '-') { const char c =3D *(p++); =20 err =3D parse_line_num(&p, &lr->end, "end line"); if (err) - goto err; + goto out; =20 if (c =3D=3D '+') { lr->end +=3D lr->start; @@ -1416,11 +1416,11 @@ int parse_line_range_desc(const char *arg, struct l= ine_range *lr) if (lr->start > lr->end) { semantic_error("Start line must be smaller" " than end line.\n"); - goto err; + goto out; } if (*p !=3D '\0') { semantic_error("Tailing with invalid str '%s'.\n", p); - goto err; + goto out; } } =20 @@ -1431,7 +1431,7 @@ int parse_line_range_desc(const char *arg, struct lin= e_range *lr) lr->file =3D strdup_esq(p); if (lr->file =3D=3D NULL) { err =3D -ENOMEM; - goto err; + goto out; } } if (*buf !=3D '\0') @@ -1439,7 +1439,7 @@ int parse_line_range_desc(const char *arg, struct lin= e_range *lr) if (!lr->function && !lr->file) { semantic_error("Only '@*' is not allowed.\n"); err =3D -EINVAL; - goto err; + goto out; } } else if (strpbrk_esq(buf, "/.")) lr->file =3D strdup_esq(buf); @@ -1448,10 +1448,10 @@ int parse_line_range_desc(const char *arg, struct l= ine_range *lr) else { /* Invalid name */ semantic_error("'%s' is not a valid function name.\n", buf); err =3D -EINVAL; - goto err; + goto out; } =20 -err: +out: free(buf); return err; } --=20 2.34.1