From patchwork Wed Aug 23 06:46:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9916693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 263E2600C5 for ; Wed, 23 Aug 2017 06:46:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1839D28585 for ; Wed, 23 Aug 2017 06:46:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C83B28970; Wed, 23 Aug 2017 06:46:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEB2828585 for ; Wed, 23 Aug 2017 06:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753376AbdHWGqR (ORCPT ); Wed, 23 Aug 2017 02:46:17 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:32924 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753057AbdHWGqP (ORCPT ); Wed, 23 Aug 2017 02:46:15 -0400 Received: by mail-pf0-f170.google.com with SMTP id k3so3737683pfc.0 for ; Tue, 22 Aug 2017 23:46:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=J1ZiNu4Tqpsjw1rwls8lHO3m8oQNkzlxUO44bN1Ltjs=; b=PTJwlxNFvBYJBdS1Q9zZg0DP47j/lOB3vwVF2K86FgC28O/g5fb+grZKla4k5pbc64 JrisQshPRz+jfpY6l0gb8xzMPlSXh5SqalzPeGXvjdVSgUEDC2q/dlQ20yNKy9lZ3FSG iYOII8lAlv5LvIcpeYAs+9XVIzV2edlD800lp2pbmNlEu+IAxgj4kk9PqVR1RIJ5ql18 oWznl08QlbsFjKPfIuixRTyoM2N3U04PwGykC4oj3/tajjEDgm24c3pSwiE0bJZzzRQt NL/BKz6pbPqojMnmwZCUDM4pqYd3OjjTtG4TtCcRPsd9oEXLDh0sjlKz24bNAXw3IZcX 56Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=J1ZiNu4Tqpsjw1rwls8lHO3m8oQNkzlxUO44bN1Ltjs=; b=OUreBhiQW6SknmXMx14ZkiEk4vjulU7CyY8hSYmD+dcbaisWmN5w2Q57C0enRfYP/h OvEJJXURL5iC0Tk9dmfwup1tq/3BFJu2SKw9pFUNSAn/ZyoJANQyXwnmxwfVOrWJXnOz LYPJ8zAWTGUIYjqF6wh2LhkRjr8A0f9xGI1Rl9CDl5aq8+VN4m5X0ofcWl4A0ZJIr8A9 UFC+/Zc2FlcVAFlWJM+7N3/P+WBt7AdD8DT606CECQ9H5fvpOjkA2Z2oFWYxSWQNGMUx KW4Ev8XKxrE7VuN0Q6deSjKhxGHaldu4ydn0bFTbCZCxkb62wGtNXfp7cRc57aHMdj6W WkpA== X-Gm-Message-State: AHYfb5haAWcDvTMXCr6x6b1oi7osINPeYFokJcr3/2Zv55BbXRjIsj9h 3OgABT9uGexmjQVAiBEoTw== X-Received: by 10.99.2.203 with SMTP id 194mr1693889pgc.22.1503470774635; Tue, 22 Aug 2017 23:46:14 -0700 (PDT) Received: from localhost.localdomain ([2601:602:8801:8110:e6a7:a0ff:fe0b:c9a8]) by smtp.gmail.com with ESMTPSA id n184sm1194749pga.89.2017.08.22.23.46.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Aug 2017 23:46:14 -0700 (PDT) From: Omar Sandoval To: linux-btrfs@vger.kernel.org Cc: kernel-team@fb.com Subject: [PATCH 2/7] Btrfs: fix incorrect {node, sector}size endianness from BTRFS_IOC_FS_INFO Date: Tue, 22 Aug 2017 23:46:00 -0700 Message-Id: <0f9325bfb4a8245c2fd0eb0fec73dc791a04932f.1503470354.git.osandov@fb.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval fs_info->super_copy->{node,sector}size are little-endian, but the ioctl should return the values in native endianness. Use the cached values in btrfs_fs_info instead. Found with sparse. Fixes: 80a773fbfc2d ("btrfs: retrieve more info from FS_INFO ioctl") Signed-off-by: Omar Sandoval Reviewed-by: David Sterba --- fs/btrfs/ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fa1b78cf25f6..b51124d5b8a3 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2804,9 +2804,9 @@ static long btrfs_ioctl_fs_info(struct btrfs_fs_info *fs_info, } mutex_unlock(&fs_devices->device_list_mutex); - fi_args->nodesize = fs_info->super_copy->nodesize; - fi_args->sectorsize = fs_info->super_copy->sectorsize; - fi_args->clone_alignment = fs_info->super_copy->sectorsize; + fi_args->nodesize = fs_info->nodesize; + fi_args->sectorsize = fs_info->sectorsize; + fi_args->clone_alignment = fs_info->sectorsize; if (copy_to_user(arg, fi_args, sizeof(*fi_args))) ret = -EFAULT;