Re: [PATCH] i3c: master: svc: bound IBI payload to the requested max_payload_len

Miquel Raynal <[email protected]>
Newsgroups org.infradead.lists.linux-i3c,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
>> 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/[email protected]/

TIL, thanks for the pointer Frank!

Miquèl

-- 
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.