Re: [PATCH v3 2/4] gpu: nova-core: gsp: fix length of received messages
From: Alexandre Courbot
Date: Tue Dec 16 2025 - 02:58:46 EST
On Tue Dec 16, 2025 at 3:14 PM JST, Alistair Popple wrote:
> On 2025-12-16 at 13:57 +1100, Alexandre Courbot <acourbot@xxxxxxxxxx> wrote...
>> The size of messages' payload is miscalculated, leading to extra data
>> passed to the message handler. While this is not a problem with our
>> current set of commands, others with a variable-length payload may
>> misbehave. Fix this by introducing a method returning the payload size
>> and using it.
>
> The whole inconsistency of the message element struct not including it's header
> fields in the size whilst the rpc struct does has caused endless confusion, this
> looks much better, thanks for fixing!
Indeed. It would be so much simpler if the RPC header just included the
size of its *payload* - because if we have the header to begin with, of
course it is part of the message!
Instead we have to deal with the possibility of a nonsensical length
value if it is shorter than that of the header. Thankfully a saturating
sub always yields a correct behavior, else we would have to return a
`Result`. :/
>
> Reviewed-by: Alistair Popple <apopple@xxxxxxxxxx>
Thanks!