All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@linux.intel.com>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org
Subject: Re: [PATCH] dax: check return value of dax_radix_entry()
Date: Wed, 2 Mar 2016 09:09:47 -0500	[thread overview]
Message-ID: <20160302140947.GL3730@linux.intel.com> (raw)
In-Reply-To: <1456870508-20385-1-git-send-email-ross.zwisler@linux.intel.com>

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;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <willy@linux.intel.com>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-nvdimm@ml01.01.org
Subject: Re: [PATCH] dax: check return value of dax_radix_entry()
Date: Wed, 2 Mar 2016 09:09:47 -0500	[thread overview]
Message-ID: <20160302140947.GL3730@linux.intel.com> (raw)
In-Reply-To: <1456870508-20385-1-git-send-email-ross.zwisler@linux.intel.com>

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;

  reply	other threads:[~2016-03-02 14:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 22:15 [PATCH] dax: check return value of dax_radix_entry() Ross Zwisler
2016-03-01 22:15 ` Ross Zwisler
2016-03-02 14:09 ` Matthew Wilcox [this message]
2016-03-02 14:09   ` Matthew Wilcox
2016-03-02 16:33   ` Ross Zwisler
2016-03-02 16:33     ` Ross Zwisler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160302140947.GL3730@linux.intel.com \
    --to=willy@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=ross.zwisler@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.