lkml.org 
[lkml]   [2022]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] mm/shmem: check return value of shmem_init_inodecache
On Sun, Jun 05, 2022 at 11:55:55AM +0800, Chen Wandun wrote:
> It will result in null pointer access if shmem_init_inodecache fail,
> so check return value of shmem_init_inodecache

You ignored my suggestion from v1. Here, let me write it out for you.

+static int shmem_init_inodecache(void)
{
shmem_inode_cachep = kmem_cache_create("shmem_inode_cache",
sizeof(struct shmem_inode_info),
0, SLAB_PANIC|SLAB_ACCOUNT, shmem_init_inode);
+ if (!shmem_inode_cachep)
+ return -ENOMEM;
+ return 0;
}

...

+ error = shmem_init_inodecache();
+ if (error)
+ goto out2;

\
 
 \ /
  Last update: 2022-06-05 13:50    [W:0.135 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site