mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@mail.ru>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: Steve French <sfrench@samba.org>,
	linux-kernel@vger.kernel.org, samba-technical@lists.samba.org
Subject: [PATCH] fs/cifs/cifssmb.c: fix endianness warnings
Date: Thu, 17 Feb 2005 02:32:42 +0200	[thread overview]
Message-ID: <200502170232.42363.adobriyan@mail.ru> (raw)

fs/cifs/cifssmb.c: fix endianness warnings brought by __le'ifying
posix_acl_xattr_entry.

Patch for posix_acl_xattr_entry is at:
	http://marc.theaimsgroup.com/?l=linux-kernel&m=110858530106333&q=raw

Signed-off-by: Alexey Dobriyan <adobriyan@mail.ru>

Index: linux-warnings/fs/cifs/cifssmb.c
===================================================================
--- linux-warnings/fs/cifs/cifssmb.c	(revision 9)
+++ linux-warnings/fs/cifs/cifssmb.c	(revision 10)
@@ -1764,9 +1764,9 @@
 static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace * cifs_ace)
 {
 	/* u8 cifs fields do not need le conversion */
-	ace->e_perm = (__u16)cifs_ace->cifs_e_perm; 
-	ace->e_tag  = (__u16)cifs_ace->cifs_e_tag;
-	ace->e_id   = (__u32)le64_to_cpu(cifs_ace->cifs_uid);
+	ace->e_perm = cpu_to_le16((__u16)cifs_ace->cifs_e_perm);
+	ace->e_tag  = cpu_to_le16((__u16)cifs_ace->cifs_e_tag);
+	ace->e_id   = cpu_to_le32((__u32)le64_to_cpu(cifs_ace->cifs_uid));
 	/* cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id)); */
 
 	return;
@@ -1817,7 +1817,7 @@
 	} else if(size > buflen) {
 		return -ERANGE;
 	} else /* buffer big enough */ {
-		local_acl->a_version = POSIX_ACL_XATTR_VERSION;
+		local_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION);
 		for(i = 0;i < count ;i++) {
 			cifs_convert_ace(&local_acl->a_entries[i],pACE);
 			pACE ++;
@@ -1831,14 +1831,15 @@
 {
 	__u16 rc = 0; /* 0 = ACL converted ok */
 
-	cifs_ace->cifs_e_perm = (__u8)cpu_to_le16(local_ace->e_perm);
-	cifs_ace->cifs_e_tag =  (__u8)cpu_to_le16(local_ace->e_tag);
+	cifs_ace->cifs_e_perm = (__u8)le16_to_cpu(local_ace->e_perm);
+	cifs_ace->cifs_e_tag = (__u8)le16_to_cpu(local_ace->e_tag);
 	/* BB is there a better way to handle the large uid? */
-	if(local_ace->e_id == -1) {
+	if(local_ace->e_id == cpu_to_le32(-1)) {
 	/* Probably no need to le convert -1 on any arch but can not hurt */
 		cifs_ace->cifs_uid = cpu_to_le64(-1);
 	} else 
-		cifs_ace->cifs_uid = (__u64)cpu_to_le32(local_ace->e_id);
+		cifs_ace->cifs_uid =
+			cpu_to_le64((__u64)le32_to_cpu(local_ace->e_id));
         /*cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id));*/
 	return rc;
 }
@@ -1859,15 +1860,15 @@
 	count = posix_acl_xattr_count((size_t)buflen);
 	cFYI(1,("setting acl with %d entries from buf of length %d and version of %d",
 		count,buflen,local_acl->a_version));
-	if(local_acl->a_version != 2) {
+	if(local_acl->a_version != cpu_to_le32(POSIX_ACL_XATTR_VERSION)) {
 		cFYI(1,("unknown POSIX ACL version %d",local_acl->a_version));
 		return 0;
 	}
 	cifs_acl->version = cpu_to_le16(1);
 	if(acl_type == ACL_TYPE_ACCESS) 
-		cifs_acl->access_entry_count = count;
+		cifs_acl->access_entry_count = cpu_to_le16(count);
 	else if(acl_type == ACL_TYPE_DEFAULT)
-		cifs_acl->default_entry_count = count;
+		cifs_acl->default_entry_count = cpu_to_le16(count);
 	else {
 		cFYI(1,("unknown ACL type %d",acl_type));
 		return 0;

                 reply	other threads:[~2005-02-16 23:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200502170232.42363.adobriyan@mail.ru \
    --to=adobriyan@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samba-technical@lists.samba.org \
    --cc=sfrench@samba.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®