[2/8] cifs: Check for equality with ACL_TYPE_ACCESS and ACL_TYPE_DEFAULT
diff mbox

Message ID 1460586620-5717-3-git-send-email-agruenba@redhat.com
State New
Headers show

Commit Message

Andreas Gruenbacher April 13, 2016, 10:30 p.m. UTC
The two values ACL_TYPE_ACCESS and ACL_TYPE_DEFAULT are meant to be
enumerations, not bits in a bit mask.  Use '==' instead of '&' to check
for these values.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/cifs/cifssmb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Steve French April 14, 2016, 4:26 a.m. UTC | #1
merged into cifs-2.6.git

On Wed, Apr 13, 2016 at 5:30 PM, Andreas Gruenbacher
<agruenba@redhat.com> wrote:
> The two values ACL_TYPE_ACCESS and ACL_TYPE_DEFAULT are meant to be
> enumerations, not bits in a bit mask.  Use '==' instead of '&' to check
> for these values.
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>  fs/cifs/cifssmb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index 76fcb50..f24a89c 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -3366,7 +3366,7 @@ static int cifs_copy_posix_acl(char *trgt, char *src, const int buflen,
>         if (le16_to_cpu(cifs_acl->version) != CIFS_ACL_VERSION)
>                 return -EOPNOTSUPP;
>
> -       if (acl_type & ACL_TYPE_ACCESS) {
> +       if (acl_type == ACL_TYPE_ACCESS) {
>                 count = le16_to_cpu(cifs_acl->access_entry_count);
>                 pACE = &cifs_acl->ace_array[0];
>                 size = sizeof(struct cifs_posix_acl);
> @@ -3377,7 +3377,7 @@ static int cifs_copy_posix_acl(char *trgt, char *src, const int buflen,
>                                  size_of_data_area, size);
>                         return -EINVAL;
>                 }
> -       } else if (acl_type & ACL_TYPE_DEFAULT) {
> +       } else if (acl_type == ACL_TYPE_DEFAULT) {
>                 count = le16_to_cpu(cifs_acl->access_entry_count);
>                 size = sizeof(struct cifs_posix_acl);
>                 size += sizeof(struct cifs_posix_ace) * count;
> --
> 2.4.11
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 76fcb50..f24a89c 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3366,7 +3366,7 @@  static int cifs_copy_posix_acl(char *trgt, char *src, const int buflen,
 	if (le16_to_cpu(cifs_acl->version) != CIFS_ACL_VERSION)
 		return -EOPNOTSUPP;
 
-	if (acl_type & ACL_TYPE_ACCESS) {
+	if (acl_type == ACL_TYPE_ACCESS) {
 		count = le16_to_cpu(cifs_acl->access_entry_count);
 		pACE = &cifs_acl->ace_array[0];
 		size = sizeof(struct cifs_posix_acl);
@@ -3377,7 +3377,7 @@  static int cifs_copy_posix_acl(char *trgt, char *src, const int buflen,
 				 size_of_data_area, size);
 			return -EINVAL;
 		}
-	} else if (acl_type & ACL_TYPE_DEFAULT) {
+	} else if (acl_type == ACL_TYPE_DEFAULT) {
 		count = le16_to_cpu(cifs_acl->access_entry_count);
 		size = sizeof(struct cifs_posix_acl);
 		size += sizeof(struct cifs_posix_ace) * count;