From: Fayssal Benmlih <Fayssal.Benmlih@arm.com>
To: Cristian Marussi <Cristian.Marussi@arm.com>
Cc: "arm-scmi@vger.kernel.org" <arm-scmi@vger.kernel.org>,
"d-gole@ti.com" <d-gole@ti.com>,
"david@kernel.org" <david@kernel.org>,
Elif Topuz <Elif.Topuz@arm.com>,
"etienne.carriere@st.com" <etienne.carriere@st.com>,
"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
"james.quinlan@broadcom.com" <james.quinlan@broadcom.com>,
"jic23@kernel.org" <jic23@kernel.org>,
"kas@kernel.org" <kas@kernel.org>,
"kernel-team@meta.com" <kernel-team@meta.com>,
"leitao@kernel.org" <leitao@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Lukasz Luba <Lukasz.Luba@arm.com>,
"michal.simek@amd.com" <michal.simek@amd.com>,
"peng.fan@oss.nxp.com" <peng.fan@oss.nxp.com>,
Philip Radford <Philip.Radford@arm.com>,
"puranjay@kernel.org" <puranjay@kernel.org>,
Souvik Chakravarty <Souvik.Chakravarty@arm.com>,
"sudeep.holla@kernel.org" <sudeep.holla@kernel.org>,
"usama.arif@linux.dev" <usama.arif@linux.dev>,
"vincent.guittot@linaro.org" <vincent.guittot@linaro.org>
Subject: Re: [PATCH v10 24/24] [RFC] tools/scmi: Add SCMI Telemetry testing tool
Date: Fri, 21 Aug 2026 15:24:57 +0000 [thread overview]
Message-ID: <CFAC3196-972C-4AC2-A08E-EC8DEC125610@contoso.com> (raw)
In-Reply-To: <<20260815232604.3730754-25-cristian.marussi@arm.com>>
Hi Cristian,
The main test-tool issues reported on V7 still appear present in V10.
open_session() allocates struct tlm_state using malloc() without
initializing it. Optional members such as grps and shmtis can therefore
contain arbitrary pointers when the corresponding resource count is zero.
Please use calloc() or initialize the complete object.
Zero-resource handling is still incomplete. gather_tlm_state() always calls
enumerate_intervals() for the instance, and enumerate_groups() calls it even
when a group reports zero intervals. Display and SHMTI command paths also
dereference optional pointers without consistently checking both the count
and pointer.
Please avoid zero-sized enumerations and make every consumer tolerate a NULL
optional resource.
dump_shmti() and shmti_check() still map only shmti->len bytes before adding
shmti->offset. The mapping needs to cover PAGE_ALIGN(offset + len), and its
original base and complete length must be retained for munmap().
The write loop also still adds write() directly to the cumulative byte
count:
bytes += write(...);
A -1 result after an earlier successful write can leave bytes nonnegative,
and a zero result can loop indefinitely. Please store the result separately,
handle values less than or equal to zero, and unmap on every exit.
batch_read() allocates space for st->info.num_des entries and then replaces
batch->num_items with args->cnt before writing that many samples. More
command-line IDs than platform DEs therefore write past the allocation.
Please allocate using the validated argument count or reject excessive
arguments before populating the array.
batch_buffer_alloc() still uses unchecked multiplications. If status
allocation fails, the previously allocated item array and wrapper are also
leaked. Please use checked size arithmetic and one unwind path.
More generally, the tool still has no complete session cleanup. The main
device fd, returned SHMTI fds, mappings, interval arrays, DE/group
descriptors, batch buffers and nested allocations remain open or allocated
on normal and error exits.
Please add a session cleanup function and route all exits through it. Apart
from fixing the leaks, that will provide a useful executable example of the
intended UAPI lifetime rules.
Thanks,
Fayçal
next parent reply other threads:[~2026-08-21 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <<20260815232604.3730754-25-cristian.marussi@arm.com>
2026-08-21 15:24 ` Fayssal Benmlih [this message]
2026-08-15 23:25 [PATCH v10 00/24] Introduce SCMI Telemetry support Cristian Marussi
2026-08-15 23:26 ` [PATCH v10 24/24] [RFC] tools/scmi: Add SCMI Telemetry testing tool Cristian Marussi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CFAC3196-972C-4AC2-A08E-EC8DEC125610@contoso.com \
--to=fayssal.benmlih@arm.com \
--cc=Cristian.Marussi@arm.com \
--cc=Elif.Topuz@arm.com \
--cc=Lukasz.Luba@arm.com \
--cc=Philip.Radford@arm.com \
--cc=Souvik.Chakravarty@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=d-gole@ti.com \
--cc=david@kernel.org \
--cc=etienne.carriere@st.com \
--cc=f.fainelli@gmail.com \
--cc=james.quinlan@broadcom.com \
--cc=jic23@kernel.org \
--cc=kas@kernel.org \
--cc=kernel-team@meta.com \
--cc=leitao@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=peng.fan@oss.nxp.com \
--cc=puranjay@kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=usama.arif@linux.dev \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox