* [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc
@ 2016-05-25 22:04 Salah Triki
2016-05-26 13:59 ` Richard Weinberger
0 siblings, 1 reply; 2+ messages in thread
From: Salah Triki @ 2016-05-25 22:04 UTC (permalink / raw)
To: richard, dedekind1, adrian.hunter; +Cc: Salah Triki, linux-mtd, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc
2016-05-25 22:04 [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc Salah Triki
@ 2016-05-26 13:59 ` Richard Weinberger
0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2016-05-26 13:59 UTC (permalink / raw)
To: Salah Triki, dedekind1, adrian.hunter; +Cc: linux-mtd, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-26 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-25 22:04 [PATCH] fs: ubifs: Replace kmem_cache_alloc/memset with kmem_cache_zalloc Salah Triki
2016-05-26 13:59 ` Richard Weinberger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.