From patchwork Mon Oct 24 21:32:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13018177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1436C38A2D for ; Mon, 24 Oct 2022 21:32:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 29C0E940008; Mon, 24 Oct 2022 17:32:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 22470940007; Mon, 24 Oct 2022 17:32:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C575940008; Mon, 24 Oct 2022 17:32:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id ECA4C940007 for ; Mon, 24 Oct 2022 17:32:20 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C097AAA3FB for ; Mon, 24 Oct 2022 21:32:20 +0000 (UTC) X-FDA: 80057141640.20.3B29CB4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 561A210001F for ; Mon, 24 Oct 2022 21:32:20 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E273615B7; Mon, 24 Oct 2022 21:32:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD933C433C1; Mon, 24 Oct 2022 21:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666647138; bh=8s0hKk0Z/T43b3xhGakn1BjmwUXrTzEKBvsf0syOS9Y=; h=Date:From:To:Cc:Subject:From; b=VV2DOSCrwfFzEt2UbWc9JLdxjhbRmcZ9gJKyPCCDNA55I0Zjuq1sdrAZ7oZmyB6ln 68DZXFGKOFyxkVwYbKeNEZhVEqnxRjuS6LWqR5EOjkRnqhDmM2vl/XJt8h++rikEG+ u4nxZ2gWis1uRDbFvc2iBo4dLV0U9jejrt/OEJHfZn0t5AMPyzw6SnX9rpg4W1gh0U 165liIkfgwHHH0cjyx0Zttn/gV4Rr3HRx5mCisOXIZBFqVdCdEXocqK9dwf0uKiXB9 fKACXansolI5JT//YmqGk8hPRDMbQiUdu8NXKV9l/gf/5k1R3ySPDV2hvNwApxqJtV ZnrICvuVVQ+/g== Date: Mon, 24 Oct 2022 14:32:18 -0700 From: "Darrick J. Wong" To: xfs Cc: Shiyang Ruan , Andrew Morton , Linux Memory Management List Subject: [PATCH] xfs: fix incorrect return type for fsdax fault handlers Message-ID: MIME-Version: 1.0 Content-Disposition: inline ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666647140; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=rVoXs4aURk6CTxJD+uU3cMWo9lMs6ckTBNXM9w2yWPI=; b=uEbdsTG2IMfikc7IAqxSsgIpTbWhaoU6mWXbRVxnbN2u/Py3CkvDE/XyrAaW0f8SRwqq4Y 5BM2OBLzYULOq5V92vq9QqHNZ1FYy+7O8WwjAMdDQQ7/p8EFcONYfHmvDKw+7xPtOTRjEs /3Yc5QqVQdpJ53MWQBg+zarplS3yyag= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VV2DOSCr; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of djwong@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=djwong@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666647140; a=rsa-sha256; cv=none; b=H1R1GTh5fzxUmTZWobcrznUMfxw5NbzhVcDh1v6XX0MKpHtN/y9JMWyE5GVvLcECXbgUxn RTvOfKm6C682YGeha4OGeYETEQoJ4d9XfdpdwE/IWDnkLmw4wUpmJp/mqIeJ2+mfNZ8XQy OZBry6wa/6Va+ZzNAQZoengpBmchorA= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 561A210001F X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VV2DOSCr; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of djwong@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=djwong@kernel.org X-Stat-Signature: r9ubkke8zuijn3o469auzieh7i5kdxca X-HE-Tag: 1666647140-604301 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Darrick J. Wong The kernel robot complained about this: >> fs/xfs/xfs_file.c:1266:31: sparse: sparse: incorrect type in return expression (different base types) @@ expected int @@ got restricted vm_fault_t @@ fs/xfs/xfs_file.c:1266:31: sparse: expected int fs/xfs/xfs_file.c:1266:31: sparse: got restricted vm_fault_t fs/xfs/xfs_file.c:1314:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted vm_fault_t [usertype] ret @@ got int @@ fs/xfs/xfs_file.c:1314:21: sparse: expected restricted vm_fault_t [usertype] ret fs/xfs/xfs_file.c:1314:21: sparse: got int Fix the incorrect return type for these two functions, and make the !fsdax version return SIGBUS since there is no vm_fault_t that maps to zero. Fixes: ea6c49b784f0 ("xfs: support CoW in fsdax mode") Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index c6c80265c0b2..6b328ffaf629 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1261,7 +1261,7 @@ xfs_file_llseek( } #ifdef CONFIG_FS_DAX -static int +static inline vm_fault_t xfs_dax_fault( struct vm_fault *vmf, enum page_entry_size pe_size, @@ -1274,14 +1274,14 @@ xfs_dax_fault( &xfs_read_iomap_ops); } #else -static int +static inline vm_fault_t xfs_dax_fault( struct vm_fault *vmf, enum page_entry_size pe_size, bool write_fault, pfn_t *pfn) { - return 0; + return VM_FAULT_SIGBUS; } #endif