All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
	"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH 1/3] ndctl: fix ndctl_bus_cmd_new_ars_status() input validation
Date: Fri, 11 Mar 2016 01:17:32 +0000	[thread overview]
Message-ID: <1457659048.4525.37.camel@intel.com> (raw)
In-Reply-To: <20160311004516.27582.37530.stgit@dwillia2-desk3.jf.intel.com>

On Thu, 2016-03-10 at 16:45 -0800, Dan Williams wrote:
> Check that ars_status, rather than ars_cap, commands are supported and
> validate that the reference ars_cap passed in is indeed and ars_cap

s/and/an/

> command.
> 
> Cc: Vishal Verma <vishal.l.verma@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  lib/libndctl-ars.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/libndctl-ars.c b/lib/libndctl-ars.c
> index ad85191898d4..63d0e5544a36 100644
> --- a/lib/libndctl-ars.c
> +++ b/lib/libndctl-ars.c
> @@ -55,7 +55,7 @@ NDCTL_EXPORT struct ndctl_cmd
> *ndctl_bus_cmd_new_ars_start(struct ndctl_cmd *ars
>  		dbg(ctx, "unsupported cmd\n");
>  		return NULL;
>  	}
> -	if (ars_cap->status != 0) {
> +	if (ars_cap->type != ND_CMD_ARS_CAP || ars_cap->status != 0)
> {
>  		dbg(ctx, "expected sucessfully completed ars_cap
> command\n");
>  		return NULL;
>  	}
> @@ -94,11 +94,11 @@ NDCTL_EXPORT struct ndctl_cmd
> *ndctl_bus_cmd_new_ars_status(struct ndctl_cmd *ar
>  	struct ndctl_cmd *cmd;
>  	size_t size;
>  
> -	if (!ndctl_bus_is_cmd_supported(bus, ND_CMD_ARS_CAP)) {
> +	if (!ndctl_bus_is_cmd_supported(bus, ND_CMD_ARS_STATUS)) {

Good catch :)

>  		dbg(ctx, "unsupported cmd\n");
>  		return NULL;
>  	}
> -	if (ars_cap->status != 0) {
> +	if (ars_cap->type != ND_CMD_ARS_CAP || ars_cap->status != 0)
> {
>  		dbg(ctx, "expected sucessfully completed ars_cap
> command\n");
>  		return NULL;
>  	}
> 

Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2016-03-11  1:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11  0:45 [ndctl PATCH 0/3] ndctl: clear error support for v52 Dan Williams
2016-03-11  0:45 ` [ndctl PATCH 1/3] ndctl: fix ndctl_bus_cmd_new_ars_status() input validation Dan Williams
2016-03-11  1:17   ` Verma, Vishal L [this message]
2016-03-11  0:45 ` [ndctl PATCH 2/3] ndctl: disable nfit_test regions after test Dan Williams
2016-03-11  0:45 ` [ndctl PATCH 3/3] ndctl: add 'clear error' command support Dan Williams
2016-03-11  1:19   ` Verma, Vishal L
2016-03-11  4:08     ` Dan Williams

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=1457659048.4525.37.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /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.