From patchwork Tue Mar 15 22:58:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 638151 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2FMufb5007754 for ; Tue, 15 Mar 2011 22:58:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752787Ab1COW6k (ORCPT ); Tue, 15 Mar 2011 18:58:40 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:62113 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116Ab1COW6k (ORCPT ); Tue, 15 Mar 2011 18:58:40 -0400 Received: by fxm17 with SMTP id 17so1130243fxm.19 for ; Tue, 15 Mar 2011 15:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to:cc :content-type; bh=GiB4xUB55wUNLQH4+B93U/Tvrq93lZ1oWzN7UJXX4kU=; b=o4x7Cm/Z8ejJ67RSpv44PK4Wz2NNLao3Q3RZrkX6kgcgxFsBXUNizyUOJ1jYPrd6uu uCL9qYd31cFO3MxNpaVnFRcUSvb6OD5OLPew1RCawDRse8vMnaduGTi6uUg8JFBoK2vb 5309xjSjbLsWe48ER8kQVRJv78wZ3VeBQKDGk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=u8naoYOCtr1O2gyixRouCuK9xSMaunQ/KH2pDHQyUoR0I/ItUuilGqmp7CQp3AfcSn zEGs33AUZ4KgS+HpABxZCqADthLh56Mfyyd2b+pXFheTbGfkFvBVTcitTfrpGRk5MtcE kp1uexj686d1tkTAtEU5yGDp0W2wFccqhYDSo= MIME-Version: 1.0 Received: by 10.223.2.2 with SMTP id 2mr106938fah.47.1300229900586; Tue, 15 Mar 2011 15:58:20 -0700 (PDT) Received: by 10.223.118.15 with HTTP; Tue, 15 Mar 2011 15:58:20 -0700 (PDT) Date: Tue, 15 Mar 2011 17:58:20 -0500 Message-ID: Subject: Removing endian warning due to mixed endian use by cifs of smb_buf_length From: Steve French To: linux-cifs@vger.kernel.org Cc: Jeff Layton Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 15 Mar 2011 22:58:40 +0000 (UTC) diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 1a2930d..6085ac3 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -119,8 +119,7 @@ delete_mid(struct mid_q_entry *mid) DeleteMidQEntry(mid); } -static int -smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) +int smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) { int rc = 0; int i = 0; @@ -154,7 +153,17 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) for (i = 0; i < n_vec; i++) total_len += iov[i].iov_len; - smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); + /* In SMB2 we treat the buffer length in its native form + (always be32 for RFC1001 length), but in all of the cifs + callers the equivalent, smb_buf_length, is treated + as host endian until right before we send it (here) so + has to be converted to big endian below. Would be + too big a change for cifspdu.c to change the many + dozen places that treat it as host endian for cifs, but + at least for smb2 we can treat it as host endian */ + if (server->is_smb2 == false) + smb_buffer->smb_buf_length = (__force __u32) + cpu_to_be32(smb_buffer->smb_buf_length); cFYI(1, "Sending smb: total_len %d", total_len); dump_smb(smb_buffer, len);