From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796216118; b=qgpbzbUmHLyap9rQBPlcIy5LMoh2KuiGz+l6vYUg4qvykzs4Xg8XE84jWaaBP5KNofdd yZ/mWBBaTEI5Kj4B9Y68LSBjXRLRh6UwKcVKld4LIEQoev4MN06j/pf9/wBbQAEOTyB/J uORSAyKUg81OVO+6f3WVPenwToNJbiMdyBd2sBGLgc81UNLKCrVCRVf0Mj8VI01Y3geHU oJOTfggIv/pQNWQ5YvWJOrQiDLxFs667J9ZHbfQH/JMOqxVBAGE+REKSjjfwnkMK+PY1R wW0qHbQ82QzVPJmjGp9FTYBEXMq3Shq698X7WVPOvcyPtzdTwPQxFhqaLuvawfvh5Ew== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796216118; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=GXzOryZJeAjgUxnEZKVZvJ72oPwS0uZj51JSNZ7RVes=; b=ZPFtsGexJrrZEFp1uZ8/PDOT9EEFF+FEiVILf6Xww09JHxaSuvlpdgpE36+JoIn/9jCA X3eghhls29974jG/KEVJFAOltA0Bb2SFjoOoSzur9lHozOxK3fGLtMXE58JyDoO/z2+5g cxi85LBKsm7QMHNCAP0TVS39ArhKC9i5qw+wepcEojqOXzCFbfo4WQ9iV3BZfszNcOKLm M34XfExJupkqmqOBYXXBrxVyuMMyXEPoNL3uSTaQZzbQw/88S9oT33dREqvjOO7RDcZGR rZAF2F4dVbXlg+sqQPUXNYsP6OgLJxFN1iEeVUh2HtSpd11bL5VsIvRxYo9GDFnPsvg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cndXZc1j; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09905606A31A for ; Wed, 2 Dec 2026 12:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cndXZc1j Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1726F1F000C1; Wed, 2 Dec 2026 12:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796216117; bh=GXzOryZJeAjgUxnEZKVZvJ72oPwS0uZj51JSNZ7RVes=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=cndXZc1jOoEnEaYd0MYejuyIESxOSxSg02CJvNdd2CwgPexk/u7ZgLX6WibI4vbUR I20TZsc0imlEdP4Vy23Ij7BannnVeYKGibQW2d9kHMurr/Hu+EQKRHRG+NjqS5QUrO 1qus4n3k1k0n4WdSJk1fTjLDRFLbLaWGm9R68Q5VYmP4z1O2cdii80auku2OjWqziQ XiHWL7qOylXHdXiZK9ofOQS7uLRS5F0cFma/DWJPUdWZlme8xo61ULcUyedv2WKn+b HqLfZ4qjOY3+Su/HtQ5WotyTJbXvPy+gci0EeZitR4+uHuAHtT+rnGqFoAf+ulMnXm g4zAsbBcsJkaw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH V2 1/2] perf disasm powerpc: Don't use a string literal as the instruction name Reply-To: sashiko-reviews@lists.linux.dev To: "Athira Rajeev" Cc: linux-perf-users@vger.kernel.org In-Reply-To: <20261202124337.10434-1-atrajeev@linux.ibm.com> References: <20261202124337.10434-1-atrajeev@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 12:55:16 +0000 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] perf disasm: memory leak of dl->ins.name in disasm_line__parse_powerpc() -- commit 672ddb2e1e6cdd2923c6ba2964448e4efdf6e08b Author: Athira Rajeev perf disasm powerpc: Don't use a string literal as the instruction name This commit allocates an empty string with strdup("") in disasm_line__parse_powerpc() when the disassembler is not used, avoiding an invalid free() of a string literal in disasm_line__free(). > diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c > index 7c289b67b5bde..ac69ce93b0486 100644 > --- a/tools/perf/util/disasm.c > +++ b/tools/perf/util/disasm.c > @@ -901,10 +901,17 @@ static int disasm_line__parse_powerpc(struct disasm= _line *dl, struct annotate_ar > if (name_raw_insn[0] =3D=3D '\0') > return -1; > =20 > - if (disasm) > + if (disasm) { > ret =3D disasm_line__parse(name, namep, rawp); > - else > - *namep =3D ""; > + } else { > + /* > + * The name is freed in disasm_line__free() and may be replaced > + * by check_ppc_insn(), so it must be heap allocated. > + */ > + *namep =3D strdup(""); > + if (*namep =3D=3D NULL) > + return -1; > + } > =20 > tmp_raw_insn =3D strndup(name_raw_insn, 11); > if (tmp_raw_insn =3D=3D NULL) [Severity: Low] Does this leak *namep (dl->ins.name) if strndup() fails right after strdup("")? Returning -1 sends the caller disasm_line__new() to out_free_line, which frees dl->al and dl without freeing dl->ins.name. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202124337.1043= 4-1-atrajeev@linux.ibm.com?part=3D1