Thread (52 messages) 52 messages, 4 authors, 2024-01-19

Re: [PATCH 10/18] tty: serial: samsung: make max_count unsigned int

From: Sam Protsenko <semen.protsenko@linaro.org>
Date: 2024-01-17 16:27:42
Also in: linux-samsung-soc, linux-serial, lkml

On Wed, Jan 17, 2024 at 9:54 AM Tudor Ambarus [off-list ref] wrote:


On 1/17/24 15:38, André Draszik wrote:
quoted
quoted
quoted
quoted
+       unsigned int max_count = port->fifosize;
What if port->fifosize is 0? Then this code below:

    while (max_count-- > 0) {

would cause int overflow, if max_count is unsigned?
good catch, Sam!
Does it matter, though? As this is a post-decrement, the test is done first, and the
decrement after. Therefore, it'll still bail out as expected.
Indeed, it doesn't. This reminds me of stop replying to emails at the
end of the day :)
And it reminds me to drink some coffee in the morning before doing any
reviews :) With above condition sorted, feel free to add:

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Cheers Andre'!
ta
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help