On Sun, Sep 17, 2023 at 10:58 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote: > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > > gpio_sim_make_line_names() returns NULL or ERR_PTR() so we must not use > __free(kfree) on the returned address. Split this function into two, one > that determines the size of the "gpio-line-names" array to allocate and > one that actually sets the names at correct offsets. The allocation and > assignment of the managed pointer happens in between. > > Fixes: 3faf89f27aab ("gpio: sim: simplify code with cleanup helpers") > Reported-by: Alexey Dobriyan <adobriyan@xxxxxxxxx> > Closes: https://lore.kernel.org/all/07c32bf1-6c1a-49d9-b97d-f0ae4a2b42ab@p183/ > Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > --- I'm sorry for the noise, I realized I dropped the `if (line->offset >= bank->num_lines)` check that were added by commit d7459efc9276 ("gpio: sim: quietly ignore configured lines outside the bank") for a reason. I need to send a v3 with that restored. Bartosz