On Fri, Mar 25, 2022 at 05:14:43PM +0800, jianchunfu wrote: > I'm not sure why there are so many missing checks of the malloc function, > is it because the memory allocated is only a few bytes > so no checks are needed? > > Signed-off-by: jianchunfu <jianchunfu@xxxxxxxxxxxxxxxxxxxx> > --- > fs/unicode/mkutf8data.c | 54 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 54 insertions(+) > mkutf8data is a host tool used during the build, not kernel code, so it doesn't really matter. If malloc returns NULL, the tool will crash, which will be treated as a build error, just like if it cleanly reported a failure. It's definitely poor practice, though. How about just adding and using a helper function "xmalloc()" that has a NULL check built in? That would be much simpler than your patch. - Eric