Re: [PATCH net v2] net: wwan: t7xx: Fix off-by-one error in t7xx_dpmaif_rx_buf_alloc()

From: Jakub Kicinski
Date: Thu Oct 31 2024 - 22:16:47 EST


On Wed, 30 Oct 2024 18:01:07 +0200 Sergey Ryazanov wrote:
> On October 29, 2024 2:56:00 PM, Jinjie Ruan <ruanjinjie@xxxxxxxxxx> wrote:
> >The error path in t7xx_dpmaif_rx_buf_alloc(), free and unmap the already
> >allocated and mapped skb in a loop, but the loop condition terminates when
> >the index reaches zero, which fails to free the first allocated skb at
> >index zero.
> >
> >Check for >= 0 so that skb at index 0 is freed as well.
> >
> >Fixes: d642b012df70 ("net: wwan: t7xx: Add data path interface")
> >Suggested-by: Sergey Ryazanov <ryazanov.s.a@xxxxxxxxx>
> >Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
>
> Jakub, when applying, could you drop that suggested-by tag, please.
> My contribution was only a small suggestion to avoid an endless loop.
> In all other meanings this patch is original work made by Jinjie, and
> all creds should go to him.

TBH I find the while (i--) solution suggested by Ilpo more idiomatic,
too, let's do a v3 with that and without unnecessary Suggested-by tags.