Re: [PATCH v5] accel/qaic: tighten integer overflow checking in map_user_pages()

2023-08-09 Thread Jeffrey Hugo
On 8/7/2023 8:43 AM, Dan Carpenter wrote: On Mon, Aug 07, 2023 at 05:09:34PM +0300, Dan Carpenter wrote: The encode_dma() function has some validation on in_trans->size but it's not complete and it would be more clear to move those checks to find_and_map_user_pages(). The encode_dma() had two c

Re: [PATCH v5] accel/qaic: tighten integer overflow checking in map_user_pages()

2023-08-07 Thread Dan Carpenter
On Mon, Aug 07, 2023 at 05:09:34PM +0300, Dan Carpenter wrote: > + remaining = in_trans->size - resources->xferred_dma_size; > + total = in_trans->size + offset_in_page(xfer_start_addr); > + if (total >= SIZE_MAX) Btw, I wrote it >= instead of > to silence some idiotic static analysis.

Re: [PATCH v5] accel/qaic: tighten integer overflow checking in map_user_pages()

2023-08-07 Thread Dan Carpenter
On Mon, Aug 07, 2023 at 05:09:34PM +0300, Dan Carpenter wrote: > The encode_dma() function has some validation on in_trans->size but it's > not complete and it would be more clear to move those checks to > find_and_map_user_pages(). > > The encode_dma() had two checks: > > if (in_trans->add

[PATCH v5] accel/qaic: tighten integer overflow checking in map_user_pages()

2023-08-07 Thread Dan Carpenter
The encode_dma() function has some validation on in_trans->size but it's not complete and it would be more clear to move those checks to find_and_map_user_pages(). The encode_dma() had two checks: if (in_trans->addr + in_trans->size < in_trans->addr || !in_trans->size) ret