[PATCH] s3/vfs_btrfs.c: use sizeof() instead of ARRAY_SIZE()

Jeremy Allison jra at samba.org
Thu Feb 25 18:01:18 UTC 2016


On Thu, Feb 25, 2016 at 04:13:38PM +0100, Aurélien Aptel wrote:
> Hi,
> 
> This patch is a small fix for the btrfs vfs and was already reviewed
> by David Disseldorp on irc. Simple ARRAY_SIZE/sizeof confusion.
> 
> Please review&push

LGTM. Pushed.

> -- 
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG
> Nürnberg)

> From c536fb0e3e44bfba005ea41d6d00c6e479e304bd Mon Sep 17 00:00:00 2001
> From: Aurelien Aptel <aaptel at suse.com>
> Date: Thu, 25 Feb 2016 15:55:07 +0100
> Subject: [PATCH 2/2] s3/vfs_btrfs.c: use sizeof() instead of ARRAY_SIZE()
> 
> The `unused` member being set to zero is an uint64_t array. We want the
> byte size here.
> 
> Signed-off-by: Aurelien Aptel <aaptel at suse.com>
> Reviewed-by: David Disseldorp <ddiss at samba.org>
> ---
>  source3/modules/vfs_btrfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/modules/vfs_btrfs.c b/source3/modules/vfs_btrfs.c
> index bd95637..154fcc3 100644
> --- a/source3/modules/vfs_btrfs.c
> +++ b/source3/modules/vfs_btrfs.c
> @@ -531,7 +531,7 @@ static NTSTATUS btrfs_snap_create(struct vfs_handle_struct *handle,
>  	ioctl_arg.fd = src_fd;
>  	ioctl_arg.transid = 0;
>  	ioctl_arg.flags = (rw == false) ? BTRFS_SUBVOL_RDONLY : 0;
> -	memset(ioctl_arg.unused, 0, ARRAY_SIZE(ioctl_arg.unused));
> +	memset(ioctl_arg.unused, 0, sizeof(ioctl_arg.unused));
>  	len = strlcpy(ioctl_arg.name, dest_subvolume,
>  		      ARRAY_SIZE(ioctl_arg.name));
>  	if (len >= ARRAY_SIZE(ioctl_arg.name)) {
> -- 
> 2.1.4
> 






More information about the samba-technical mailing list