On 20/01/2023 17:58, Andy Shevchenko wrote:
On Thu, Jan 19, 2023 at 12:01:33PM +0200, Tomi Valkeinen wrote:
On 18/01/2023 16:23, Andy Shevchenko wrote:
On Wed, Jan 18, 2023 at 02:40:25PM +0200, Tomi Valkeinen wrote:
...
+ /* Ensure we have enough room to save the original addresses */
+ if (unlikely(chan->orig_addrs_size < num)) {
+ u16 *new_buf;
+
+ new_buf = kmalloc_array(num, sizeof(*new_buf), GFP_KERNEL);
I remember that I asked why we don't use krealloc_array() here... Perhaps
that we don't need to copy the old mapping table? Can we put a short comment
to clarify this in the code?
Yes, we don't care about the old data, we just require the buffer to be
large enough.
I'm not sure what kind of comment you want here. Isn't this a common idiom,
where you have a buffer for temporary data, but you might need to resize at
some point if you need a larger one?
Then why not krealloc_array()? That's the question I want to see the answer for
in the comments:
/* We don't care about old data, hence no realloc() */
Ok, I'll add that.
Tomi