Re: [PATCH -V7 21/26] richacl: xattr mapping functions

From: Andreas Gruenbacher
Date: Fri Oct 21 2011 - 19:58:25 EST


On Fri, 2011-10-21 at 18:42 +0530, Aneesh Kumar K.V wrote:
> diff --git a/fs/richacl_xattr.c b/fs/richacl_xattr.c
> index 02a7986..31e33b5 100644
> --- a/fs/richacl_xattr.c
> +++ b/fs/richacl_xattr.c
> @@ -58,19 +58,14 @@ richacl_from_xattr(const void *value, size_t size)
> goto fail_einval;
>
> richacl_for_each_entry(ace, acl) {
> - const char *who = (void *)(xattr_ace + 1), *end;
> - ssize_t used = (void *)who - value;
>
> - if (used > size)
> - goto fail_einval;
> - end = memchr(who, 0, size - used);
> - if (!end)
> + if (((void *)xattr_ace + sizeof(*xattr_ace)) > (value + size))
> goto fail_einval;

This check can be moved out of the loop now.

Other than that, I'm happy with the patch; acked.

Thanks,
Andreas

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/