Re: [PATCH] i3c: master: svc: bound IBI payload to the requested max_payload_len
From: Miquel Raynal
Date: Wed Jun 24 2026 - 03:08:03 EST
>> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
>> index e2d99a3ac07d..7420bfbdd259 100644
>> --- a/drivers/i3c/master/svc-i3c-master.c
>> +++ b/drivers/i3c/master/svc-i3c-master.c
>> @@ -465,9 +465,11 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,
>> buf = slot->data;
>>
>> while (SVC_I3C_MSTATUS_RXPEND(readl(master->regs + SVC_I3C_MSTATUS)) &&
>> - slot->len < SVC_I3C_FIFO_SIZE) {
>> + slot->len < dev->ibi->max_payload_len) {
>> mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL);
>> count = SVC_I3C_MDATACTRL_RXCOUNT(mdatactrl);
>> + count = min_t(unsigned int, count,
>> + dev->ibi->max_payload_len - slot->len);
>
> now needn't min_t, only min() should be good
> see:
> https://lore.kernel.org/all/20251119224140.8616-1-david.laight.linux@xxxxxxxxx/
TIL, thanks for the pointer Frank!
Miquèl