lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a96203c060b8e7d589a251f53bec2cd0e57292d7.camel@intel.com>
Date:   Mon, 4 Mar 2019 20:36:35 +0000
From:   "Verma, Vishal L" <vishal.l.verma@...el.com>
To:     "Williams, Dan J" <dan.j.williams@...el.com>,
        "linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] libnvdimm/namespace: Clean up holder_class_store()

On Mon, 2019-03-04 at 12:14 -0800, Dan Williams wrote:
> Use sysfs_streq() in place of open-coded strcmp()'s that check for an
> optional "\n" at the end of the input.
> 
> Signed-off-by: Dan Williams <dan.j.williams@...el.com>
> ---
>  drivers/nvdimm/namespace_devs.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Looks good,
Reviewed-by: Vishal Verma <vishal.l.verma@...el.com>

> 
> diff --git a/drivers/nvdimm/namespace_devs.c
> b/drivers/nvdimm/namespace_devs.c
> index 3677b0c4a33d..17fb7f931f0c 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -1506,13 +1506,13 @@ static ssize_t __holder_class_store(struct
> device *dev, const char *buf)
>  	if (dev->driver || ndns->claim)
>  		return -EBUSY;
>  
> -	if (strcmp(buf, "btt") == 0 || strcmp(buf, "btt\n") == 0)
> +	if (sysfs_streq(buf, "btt"))
>  		ndns->claim_class = btt_claim_class(dev);
> -	else if (strcmp(buf, "pfn") == 0 || strcmp(buf, "pfn\n") == 0)
> +	else if (sysfs_streq(buf, "pfn"))
>  		ndns->claim_class = NVDIMM_CCLASS_PFN;
> -	else if (strcmp(buf, "dax") == 0 || strcmp(buf, "dax\n") == 0)
> +	else if (sysfs_streq(buf, "dax"))
>  		ndns->claim_class = NVDIMM_CCLASS_DAX;
> -	else if (strcmp(buf, "") == 0 || strcmp(buf, "\n") == 0)
> +	else if (sysfs_streq(buf, ""))
>  		ndns->claim_class = NVDIMM_CCLASS_NONE;
>  	else
>  		return -EINVAL;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ