diff mbox

ceph: remove redundant memset(0)

Message ID 1406280364-30198-1-git-send-email-ilya.dryomov@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov July 25, 2014, 9:26 a.m. UTC
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(-)

Comments

Alex Elder July 25, 2014, 12:47 p.m. UTC | #1
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);
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);