Re: [PATCH v2 1/6] remoteproc: amd_mbv_bram: Bound device name formatting

From: Ben Levinsky

Date: Thu Nov 19 2026 - 11:29:32 EST




On 11/19/26 8:14 AM, Mathieu Poirier wrote:
> On Wed, Nov 04, 2026 at 09:18:57PM -0800, Ben Levinsky wrote:
>> rproc_mem_entry_init() interprets its name argument as a printf format
>> string. Passing the device name directly allows percent conversions in a
>> DT-derived platform device name to consume nonexistent variadic arguments.
>>
>
> I read the last sentence of the above paragraph 6 times and I still don't
> understand the problem you are describing. I'm guessing it was generated
> by an AI. Please refactor.

Hi Mathieu,

You're right, and sorry for the noise. The changelog was written with
AI assistance and I should have disclosed that on this patch as I did
on the rest of the series.

The concern was only that dev_name() ends up as the format argument of
rproc_mem_entry_init(). In practice, the name of an OF platform device
is built from the unit address and node name, and dtc does not accept
'%' in node names, so I can't point to a real case where this goes
wrong.
>
>
>> Pass the device name through a constant format so it is always handled as
>> data. Limit the formatted name to 31 characters to match the space
>> available in rproc_mem_entry::name while leaving room for its terminating
>> null byte.
>
> What to you mean by "handled as data"? Moreover, the size of
> rproc_mem_entry::name is handled properly in rproc_mem_entry_init(). What am I
> missing? I also suspect this was AI generated.

You're not missing anything. rproc_mem_entry_init() already limits the
name to sizeof(mem->name) through vsnprintf(), so the "%.31s" adds
nothing.

Since the patch doesn't fix a real problem, I'll drop it from v2 along
with the Fixes: tag. I'll also rework the changelogs of the remaining
patches so they describe the observed problem and the change in plain
terms.

Thanks,
Ben

>
>>
>> Fixes: f87b4998994e ("remoteproc: Add AMD MicroBlaze/V BRAM-based remote processor driver")
>> Reviewed-by: Tanmay Shah <tanmay.shah@xxxxxxx>
>> Signed-off-by: Ben Levinsky <ben.levinsky@xxxxxxx>
>> ---
>> drivers/remoteproc/amd_mbv_bram_rproc.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/remoteproc/amd_mbv_bram_rproc.c b/drivers/remoteproc/amd_mbv_bram_rproc.c
>> index e4a103cf8455..6cf33c7b7e64 100644
>> --- a/drivers/remoteproc/amd_mbv_bram_rproc.c
>> +++ b/drivers/remoteproc/amd_mbv_bram_rproc.c
>> @@ -72,7 +72,7 @@ static int amd_bram_rproc_prepare(struct rproc *rproc)
>> resource_size(&res), da,
>> rproc_mem_entry_ioremap_wc,
>> rproc_mem_entry_iounmap,
>> - dev_name(priv->dev));
>> + "%.31s", dev_name(priv->dev));
>> if (!mem)
>> return -ENOMEM;
>>
>> --
>> 2.34.1
>>