From patchwork Sat Nov 3 12:50:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1692321 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BC087DFB7B for ; Sat, 3 Nov 2012 12:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932321Ab2KCMu4 (ORCPT ); Sat, 3 Nov 2012 08:50:56 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:64925 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932075Ab2KCMuz (ORCPT ); Sat, 3 Nov 2012 08:50:55 -0400 Received: by mail-gg0-f174.google.com with SMTP id k5so779725ggd.19 for ; Sat, 03 Nov 2012 05:50:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=Fx/by8CvI+Rk6qJ3MUtRxSgB5Gg1KY9qVDQjO0Q3JP0=; b=neM5X2Su6rAORUglTE6GtEKGBfYunopVRF1kz0SsklrHGliu93h93DzObkvMJbnDZ3 06TTZnzTkPVIhZnmxuKhTOJktJQR0nRsgr72i7qAFXckpL6ogxIFKgGBZ4iIQ0U+7SYP kome0A6zk+N79l32ZZGeXGsSgxpef9RhnBxYQ0Bm5ZaiswJaNE9GKsEULcBvmrQXwWw/ vuXpCJ7K6aTPEdl9QDGrHmLaFmunaZ8H02miK1vUERPw4R8e/lG1PSkSS0cli+wTHhT6 v2dIINg4hXlNlw1/NM1dDlthS+6iVCjVej/+MKQbWNzZMxjKdq79yS5qEtJAcCEKBafB OWGA== Received: by 10.236.47.41 with SMTP id s29mr4449702yhb.20.1351947055664; Sat, 03 Nov 2012 05:50:55 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id n13sm11145727ano.20.2012.11.03.05.50.54 (version=SSLv3 cipher=OTHER); Sat, 03 Nov 2012 05:50:54 -0700 (PDT) From: Jeff Layton To: linux-cifs@vger.kernel.org Cc: shirishpargaonkar@gmail.com Subject: [PATCH 10/17] setcifsacl: fix up endianness conversions Date: Sat, 3 Nov 2012 08:50:27 -0400 Message-Id: <1351947034-18876-11-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1351947034-18876-1-git-send-email-jlayton@samba.org> References: <1351947034-18876-1-git-send-email-jlayton@samba.org> X-Gm-Message-State: ALoCoQmbvo7vqenqzdynXoecuOqG45Kr/Ibi07jMqXj52knqtLX8EPi24DmgnidMj0PaCMDiBjce Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Don't use htole32 when you really want le32toh. Also, when copying or comparing ACEs, it's incorrect to convert the endianness of these fields. Let's just keep things simple and declare that multibyte fields in all of these structs are always kept in little-endian. Signed-off-by: Jeff Layton --- setcifsacl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/setcifsacl.c b/setcifsacl.c index 612796b..4d9787e 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -61,9 +61,9 @@ copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, struct cifs_ctrl_acl *dacl_ptr, *ndacl_ptr; /* copy security descriptor control portion */ - osidsoffset = htole32(pntsd->osidoffset); - gsidsoffset = htole32(pntsd->gsidoffset); - dacloffset = htole32(pntsd->dacloffset); + osidsoffset = le32toh(pntsd->osidoffset); + gsidsoffset = le32toh(pntsd->gsidoffset); + dacloffset = le32toh(pntsd->dacloffset); pnntsd->revision = pntsd->revision; pnntsd->type = pntsd->type; @@ -76,7 +76,7 @@ copy_sec_desc(const struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, ndacl_ptr->revision = dacl_ptr->revision; ndacl_ptr->size = htole16(acessize + sizeof(struct cifs_ctrl_acl)); - ndacl_ptr->num_aces = htole32(numaces); + ndacl_ptr->num_aces = le32toh(numaces); /* copy owner sid */ owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + osidsoffset); @@ -110,7 +110,7 @@ copy_ace(struct cifs_ace *dace, struct cifs_ace *sace) dace->type = sace->type; dace->flags = sace->flags; - dace->access_req = htole32(sace->access_req); + dace->access_req = sace->access_req; dace->sid.revision = sace->sid.revision; dace->sid.num_subauth = sace->sid.num_subauth; @@ -119,7 +119,7 @@ copy_ace(struct cifs_ace *dace, struct cifs_ace *sace) for (i = 0; i < sace->sid.num_subauth; i++) dace->sid.sub_auth[i] = sace->sid.sub_auth[i]; - dace->size = htole16(sace->size); + dace->size = sace->size; return dace->size; } @@ -155,7 +155,7 @@ compare_aces(struct cifs_ace *sace, struct cifs_ace *dace, int compflags) } if (compflags & COMPMASK) { - if (dace->access_req != htole32(sace->access_req)) + if (dace->access_req != sace->access_req) return 0; }