From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755719AbcCBQeU (ORCPT ); Wed, 2 Mar 2016 11:34:20 -0500 Received: from mga03.intel.com ([134.134.136.65]:24855 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752956AbcCBQeT (ORCPT ); Wed, 2 Mar 2016 11:34:19 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,529,1449561600"; d="scan'208";a="662596297" Date: Wed, 2 Mar 2016 09:33:46 -0700 From: Ross Zwisler To: Matthew Wilcox Cc: Ross Zwisler , linux-kernel@vger.kernel.org, Andrew Morton , Dan Williams , linux-nvdimm@ml01.01.org Subject: Re: [PATCH] dax: check return value of dax_radix_entry() Message-ID: <20160302163346.GA22821@linux.intel.com> References: <1456870508-20385-1-git-send-email-ross.zwisler@linux.intel.com> <20160302140947.GL3730@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160302140947.GL3730@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 02, 2016 at 09:09:47AM -0500, Matthew Wilcox wrote: > On Tue, Mar 01, 2016 at 03:15:08PM -0700, Ross Zwisler wrote: > > dax_pfn_mkwrite() previously wasn't checking the return value of the call > > to dax_radix_entry(), which was a mistake. > > > > Instead, capture this return value and pass it up the stack if it is an > > error. > > > */ > > - dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, true); > > + error = dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, > > + true); > > + if (error) > > + return error; > > + > > return VM_FAULT_NOPAGE; > > You can't return an errno from here. > > if (error) > return VM_FAULT_SIGBUS; > > is better. For full points, > > if (error == -ENOMEM) > return VM_FAULT_OOM; > if (error) > return VM_FAULT_SIGBUS; > return VM_FAULT_NOPAGE; Ah, thank you for catching that.