On 6/6/23 07:37, Dan Carpenter wrote:
On Mon, Jun 05, 2023 at 06:27:47PM +0200, Mirsad Goran Todorovac wrote:
In a couple of situations like:
name = kstrndup(buf, count, GFP_KERNEL); if (!name) return -ENOSPC;
the error is not actually "No space left on device", but "Out of memory".
So, it is semantically correct to return -ENOMEM in all failed kstrndup() and kzalloc() cases in this driver, as it is not a problem with disk space, but with kernel memory allocator.
The semantically correct should be:
name = kstrndup(buf, count, GFP_KERNEL); if (!name) return -ENOMEM;
Cc: Dan Carpenter error27@gmail.com Cc: Takashi Iwai tiwai@suse.de Cc: Kees Cook keescook@chromium.org Cc: stable@vger.kernel.org Signed-off-by: Mirsad Goran Todorovac mirsad.todorovac@alu.unizg.hr
The Cc stable might be a little bit much... No Fixes tag either. But otherwise it looks fine.
Thank you. I will fix these and resubmit.
Best regards, Mirsad Todorovac
regards, dan carpenter