* [PATCH] ceph: remove redundant memset(0)
@ 2014-07-25 9:26 Ilya Dryomov
2014-07-25 12:47 ` Alex Elder
0 siblings, 1 reply; 2+ messages in thread
From: Ilya Dryomov @ 2014-07-25 9:26 UTC (permalink / raw)
To: ceph-devel; +Cc: Yan Zheng
xattrs array of pointers is allocated with kcalloc() - no need to
memset() it to 0 right after that.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
---
fs/ceph/xattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index c9c2b887381e..f89698cdbc41 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -597,7 +597,7 @@ start:
err = -ENOMEM;
if (!xattrs)
goto bad_lock;
- memset(xattrs, 0, numattr*sizeof(struct ceph_xattr *));
+
for (i = 0; i < numattr; i++) {
xattrs[i] = kmalloc(sizeof(struct ceph_inode_xattr),
GFP_NOFS);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ceph: remove redundant memset(0)
2014-07-25 9:26 [PATCH] ceph: remove redundant memset(0) Ilya Dryomov
@ 2014-07-25 12:47 ` Alex Elder
0 siblings, 0 replies; 2+ messages in thread
From: Alex Elder @ 2014-07-25 12:47 UTC (permalink / raw)
To: Ilya Dryomov, ceph-devel; +Cc: Yan Zheng
On 07/25/2014 04:26 AM, Ilya Dryomov wrote:
> xattrs array of pointers is allocated with kcalloc() - no need to
> memset() it to 0 right after that.
>
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Looks good.
Reviewed-by: Alex Elder <elder@linaro.org>
> ---
> fs/ceph/xattr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
> index c9c2b887381e..f89698cdbc41 100644
> --- a/fs/ceph/xattr.c
> +++ b/fs/ceph/xattr.c
> @@ -597,7 +597,7 @@ start:
> err = -ENOMEM;
> if (!xattrs)
> goto bad_lock;
> - memset(xattrs, 0, numattr*sizeof(struct ceph_xattr *));
> +
> for (i = 0; i < numattr; i++) {
> xattrs[i] = kmalloc(sizeof(struct ceph_inode_xattr),
> GFP_NOFS);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-25 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25 9:26 [PATCH] ceph: remove redundant memset(0) Ilya Dryomov
2014-07-25 12:47 ` Alex Elder
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.