From patchwork Tue Mar 27 14:40:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 10310317 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 7424C600F6 for ; Tue, 27 Mar 2018 14:40:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64E552465D for ; Tue, 27 Mar 2018 14:40:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5957229D7C; Tue, 27 Mar 2018 14:40:05 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 31FC82465D for ; Tue, 27 Mar 2018 14:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752019AbeC0OkD (ORCPT ); Tue, 27 Mar 2018 10:40:03 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:47438 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751110AbeC0OkC (ORCPT ); Tue, 27 Mar 2018 10:40:02 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1f0plZ-0007Q5-JF; Tue, 27 Mar 2018 14:40:01 +0000 From: Colin King To: "Darrick J . Wong" , linux-xfs@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] xfs: fix zero'ing of ILOG owner bits by using correct bitwise operator Date: Tue, 27 Mar 2018 15:40:01 +0100 Message-Id: <20180327144001.14074-1-colin.king@canonical.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King Currently the masking of the ili_fields is using the ! operator which results in masking with 0, which clears all the bits which is not intended. Instead, use the ~ operator that negates the inverts the bits to correctly mask out the XFS_ILOG_AOWNER and XFS_ILOG_DOWNER bits. Detected by CoverityScan, CID#1466877 ("Logical vs bitwise operator") Fixes: 3fdf96830762 ("xfs: do not log swapext extent owner changes for deleted") Signed-off-by: Colin Ian King --- fs/xfs/xfs_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index a16f48fde4da..3e3aab3888fa 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -2477,7 +2477,7 @@ xfs_ifree( ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; /* Don't attempt to replay owner changes for a deleted inode */ - ip->i_itemp->ili_fields &= !(XFS_ILOG_AOWNER|XFS_ILOG_DOWNER); + ip->i_itemp->ili_fields &= ~(XFS_ILOG_AOWNER|XFS_ILOG_DOWNER); /* * Bump the generation count so no one will be confused