On Tue, Jul 10, 2012 at 09:09:10AM +0800, Gavin Shan wrote: >On Tue, Jul 10, 2012 at 09:03:04AM +0800, Wanpeng Li wrote: >>From: Wanpeng Li <liwp@xxxxxxxxxxxxxxxxxx> >> >>When kmem_cache_alloc fails alloc slab object from >>hugetlbfs_inode_cachep, return -ENOMEM in usual. But >>hugetlbfs_alloc_inode implementation has inconsitency >>with it and returns NULL. Fix it to return -ENOMEM. >> >>Signed-off-by: Wanpeng Li <liwp.linux@xxxxxxxxx> >>--- >> fs/hugetlbfs/inode.c | 2 +- >> 1 files changed, 1 insertions(+), 1 deletions(-) >> >>diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >>index c4b85d0..79a0f33 100644 >>--- a/fs/hugetlbfs/inode.c >>+++ b/fs/hugetlbfs/inode.c >>@@ -696,7 +696,7 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) >> p = kmem_cache_alloc(hugetlbfs_inode_cachep, GFP_KERNEL); >> if (unlikely(!p)) { >> hugetlbfs_inc_free_inodes(sbinfo); >>- return NULL; >>+ return -ENOMEM; > >The function is expecting "struct inode *", man. > >static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) > Hmm, replace it by ERR_PTR(-ENOMEM). Regards, Wanpeng Li >Thanks, >Gavin > >> } >> return &p->vfs_inode; >> } >>-- >>1.7.5.4 >> >>-- >>To unsubscribe, send a message with 'unsubscribe linux-mm' in >>the body to majordomo@xxxxxxxxx. For more info on Linux MM, >>see: http://www.linux-mm.org/ . >>Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a> >> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>