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@xxxxxxxxx>
Cc: Takashi Iwai <tiwai@xxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@xxxxxxxxxxxx>
---
The Cc stable might be a little bit much... No Fixes tag either. But
otherwise it looks fine.
regards,
dan carpenter