Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1407254 > unrolled thread

[PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc

Started bySalah Triki <salah.triki@acm.org>
First post2016-05-26 00:10 +0200
Last post2016-05-26 16:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc Salah Triki <salah.triki@acm.org> - 2016-05-26 00:10 +0200
    Re: [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with  kmem_cache_zalloc Richard Weinberger <richard@nod.at> - 2016-05-26 16:10 +0200

#1407254 — [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc

FromSalah Triki <salah.triki@acm.org>
Date2016-05-26 00:10 +0200
Subject[PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc
Message-ID<rCPa2-6pL-15@gated-at.bofh.it>
Use kmem_cache_zalloc instead of kmem_cache_alloc/memset.

Signed-off-by: Salah Triki <salah.triki@acm.org>
---
 fs/ubifs/super.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 7034995..f509200 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -262,12 +262,10 @@ static struct inode *ubifs_alloc_inode(struct super_block *sb)
 {
 	struct ubifs_inode *ui;
 
-	ui = kmem_cache_alloc(ubifs_inode_slab, GFP_NOFS);
+	ui = kmem_cache_zalloc(ubifs_inode_slab, GFP_NOFS);
 	if (!ui)
 		return NULL;
 
-	memset((void *)ui + sizeof(struct inode), 0,
-	       sizeof(struct ubifs_inode) - sizeof(struct inode));
 	mutex_init(&ui->ui_mutex);
 	spin_lock_init(&ui->ui_lock);
 	return &ui->vfs_inode;
-- 
1.9.1

[toc] | [next] | [standalone]


#1407570 — Re: [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc

FromRichard Weinberger <richard@nod.at>
Date2016-05-26 16:10 +0200
SubjectRe: [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc
Message-ID<rD493-7pp-11@gated-at.bofh.it>
In reply to#1407254
Am 26.05.2016 um 00:04 schrieb Salah Triki:
> Use kmem_cache_zalloc instead of kmem_cache_alloc/memset.
> 
> Signed-off-by: Salah Triki <salah.triki@acm.org>
> ---
>  fs/ubifs/super.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 7034995..f509200 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -262,12 +262,10 @@ static struct inode *ubifs_alloc_inode(struct super_block *sb)
>  {
>  	struct ubifs_inode *ui;
>  
> -	ui = kmem_cache_alloc(ubifs_inode_slab, GFP_NOFS);
> +	ui = kmem_cache_zalloc(ubifs_inode_slab, GFP_NOFS);
>  	if (!ui)
>  		return NULL;
>  
> -	memset((void *)ui + sizeof(struct inode), 0,
> -	       sizeof(struct ubifs_inode) - sizeof(struct inode));

Your patch fails to explain why it is needed.
Also note that the path slightly changes the semantics.

Thanks,
//richard

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web