From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (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 3F75B3195EF for ; Wed, 24 Jun 2026 05:16:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782278169; cv=none; b=L7eOMFuuPORWq6TzGwknEDsZqi+Q7KGk+E5ERNIXEmf/+1TyL8nzXEdgB/TgbOQ7Rb7pVfQ4zExXh29EuUrSik6ll+huaVc7MrFkLmBScRBLrUgvL3vlXRvKsi5VfxI5T4P6rduodOHQFwvfSywP7AHIc9ytH09V8hcrE/3a1GQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782278169; c=relaxed/simple; bh=cL/dfi6CoH3v3+AFk/Jb+xFw+2XYxAViCqupwMQLJ/8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=W4CtjUQss6BQIBGkkJHgr9xurcTXuwW57kLQSNlhAqe9w4c14r7+oiRz/x83zpU4ANyx+Gb6gkGt4K4DOn6PsBCDWHy04OMwTvPFScpeZGo6RcZ/PEY3C7pK2ej1C87+My9EaR4Z0DzJPUQVOodJp6ajYfgtlAJ1Djzm4oLBShA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=AmYrDrG9; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AmYrDrG9" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-1394c3ee7f2so2645364c88.1 for ; Tue, 23 Jun 2026 22:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782278167; x=1782882967; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ukKLKgKMn5XXD3rBChspB6wx1KlIrbqmyT4Q8AlDVdU=; b=AmYrDrG9R+r+Dz4vom0Z3JSpM3+/s3CeSOVB4RWkRsHOf4BpcUoKx502AeVRcJVpAa UOLfLnyhukymuBolY6kmOGhKFx/+gpTz9gMDwFbHktU2tUimDmj3GHKiU2Be5pZIUoXR veMk08edyZ4bZSVdOGIB2ad+q/aVfnVhvN1YoQCfTQQGUWKRK92vCVwEU4dE/sZiYUk1 M686RSNjOBS7u2olE3Rm2Sxj1Pwb1yFJHXlssPyD4sPFjeuxP4BI3d6S7241YFV/8VEX EOg+E0Yd6tPX+0zKpb1rEfXdi/bCEbTrpsl/JU7MPWNO0S3OD27g8Ca0h3ET5urjG4Dd gVQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782278167; x=1782882967; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ukKLKgKMn5XXD3rBChspB6wx1KlIrbqmyT4Q8AlDVdU=; b=rS3SI4S9/DPUJBI8AohiF3AaxUCDhlU5dWI4yqj05s71cmvJ6ncCpI7fLamcM6v273 8aEZTBqruxJk9iaXUyQm2dnlpqGsTSwR5TTKjsn7ndxyHTkZXPc3cChF01rlKLKKXWgV zLNcvs5X4/+sRIZKK789Hwc2U7jYvf3ojKIAgWgEr8aU52wG8tuQex/UeAgj91GtOR9E ERJ5sLpQgIzJsIMDMA8O+xLrYC5Cg8Xlk5lgYMt1vBkzWJ3h/0kh7V3tTqhSZBjY/9Jy qRr1TQblXTVIHg9mXySjw0d6M+pjokgLdzhfOHnZ/yDvBsJn6Nu1iLX4cTLJtgHOmUfF tJDA== X-Forwarded-Encrypted: i=1; AFNElJ/tVPvzeoQip9Hq7KpYFd/gWqCjOKFni+/snhoDEHTRJ50tK8Xs7d4sNVsHgkPm4rj6di/3Ewoe8PG5U8s=@vger.kernel.org X-Gm-Message-State: AOJu0YwXWqMJ+0YL49K7ukyfZNaRdqqcEARmsyFjw6RGhabPdwfW9+Ot yoGpb41BJBZ64SUX3BW3XbEDSpTIB/nsvBJ3pu+4lNLLc/5anBYSCYJu1dgKQtcjmMSqdrOgqGl CRiuR6Mt/WA== X-Received: from dldyr20-n2.prod.google.com ([2002:a05:701b:4514:20b0:138:23f0:1ce5]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:222a:b0:138:33cc:d88b with SMTP id a92af1059eb24-139d0c81d73mr1708018c88.20.1782278167027; Tue, 23 Jun 2026 22:16:07 -0700 (PDT) Date: Tue, 23 Jun 2026 22:15:29 -0700 In-Reply-To: <20260624051535.3584977-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260623053515.2677888-1-irogers@google.com> <20260624051535.3584977-1-irogers@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260624051535.3584977-13-irogers@google.com> Subject: [PATCH v2 11/16] perf python: Zero initialize perf_data in pyrf_data__init From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org Cc: adrian.hunter@intel.com, alice.mei.rogers@gmail.com, dapeng1.mi@linux.intel.com, james.clark@linaro.org, leo.yan@linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, tmricht@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Replace path clearing with memset so the entire struct is zeroed, preventing uninitialized fields from causing errors later. Fixes: 4cd0142f7dec ("perf python: Add wrapper for perf_data file abstraction") Signed-off-by: Ian Rogers --- tools/perf/util/python.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 657b054f5e51..71be130b38c5 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -3621,7 +3622,7 @@ static int pyrf_data__init(struct pyrf_data *pdata, PyObject *args, PyObject *kw if (pdata->data.open) perf_data__close(&pdata->data); free((char *)pdata->data.path); - pdata->data.path = NULL; + memset(&pdata->data, 0, sizeof(pdata->data)); if (fd != -1) { struct stat st; -- 2.55.0.rc0.799.gd6f94ed593-goog