diff mbox

[10/15] btrfs-progs: fix qgroup realloc inheritance

Message ID 1376522205-16992-11-git-send-email-zab@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Zach Brown Aug. 14, 2013, 11:16 p.m. UTC
qgroup.c:82:23: warning: memcpy with byte count of 0
qgroup.c:83:23: warning: memcpy with byte count of 0

The inheritance wasn't copying qgroups[] because a confused sizeof()
gave 0 byte memcpy()s.  It's been like this for the year since it was
merged, so I guess this isn't a very important thing to do :).

Signed-off-by: Zach Brown <zab@redhat.com>
---
 qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arne Jansen Aug. 18, 2013, 8:05 a.m. UTC | #1
On 08/15/13 01:16, Zach Brown wrote:
> qgroup.c:82:23: warning: memcpy with byte count of 0
> qgroup.c:83:23: warning: memcpy with byte count of 0
> 
> The inheritance wasn't copying qgroups[] because a confused sizeof()
> gave 0 byte memcpy()s.  It's been like this for the year since it was
> merged, so I guess this isn't a very important thing to do :).

It only seems to hit if you give -[cx] before -i. I guess only very
few people use these options in the first place. They are primarily
for hosting providers.

Reviewed-by: Arne Jansen <sensille@gmx.net>
> 
> Signed-off-by: Zach Brown <zab@redhat.com>
> ---
>  qgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/qgroup.c b/qgroup.c
> index 038c4dc..86fe2b2 100644
> --- a/qgroup.c
> +++ b/qgroup.c
> @@ -74,7 +74,7 @@ qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit, int n, int pos)
>  
>  	if (*inherit) {
>  		struct btrfs_qgroup_inherit *i = *inherit;
> -		int s = sizeof(out->qgroups);
> +		int s = sizeof(out->qgroups[0]);
>  
>  		out->num_qgroups = i->num_qgroups;
>  		out->num_ref_copies = i->num_ref_copies;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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/qgroup.c b/qgroup.c
index 038c4dc..86fe2b2 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -74,7 +74,7 @@  qgroup_inherit_realloc(struct btrfs_qgroup_inherit **inherit, int n, int pos)
 
 	if (*inherit) {
 		struct btrfs_qgroup_inherit *i = *inherit;
-		int s = sizeof(out->qgroups);
+		int s = sizeof(out->qgroups[0]);
 
 		out->num_qgroups = i->num_qgroups;
 		out->num_ref_copies = i->num_ref_copies;