linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Piotr Sarna <p.sarna@partner.samsung.com>
Cc: bob.liu@oracle.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	b.zolnierkie@samsung.com,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH] zcache: fix "zcache=" kernel parameter
Date: Fri, 19 Jul 2013 11:20:16 -0400	[thread overview]
Message-ID: <20130719152016.GA13009@localhost.localdomain> (raw)
In-Reply-To: <1374245201-24474-1-git-send-email-p.sarna@partner.samsung.com>

On Fri, Jul 19, 2013 at 04:46:41PM +0200, Piotr Sarna wrote:
> Commit 835f2f5 ("staging: zcache: enable zcache to be built/loaded as
> a module") introduced an incorrect handling of "zcache=" parameter.
> 
> Inside zcache_comp_init() function, zcache_comp_name variable is
> checked for being empty. If not empty, the above variable is tested
> for being compatible with Crypto API. Unfortunately, after that
> function ends unconditionally (by the "goto out" directive) and returns:
> - non-zero value if verification succeeded, wrongly indicating an error
> - zero value if verification failed, falsely informing that function
>   zcache_comp_init() ended properly.
> 
> A solution to this problem is as following:
> 1. Move the "goto out" directive inside the "if (!ret)" statement
> 2. In case that crypto_has_comp() returned 0, change the value of ret
>    to non-zero before "goto out" to indicate an error.
> 
> Signed-off-by: Piotr Sarna <p.sarna@partner.samsung.com>
> Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

You can also add
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>


> ---
>  drivers/staging/zcache/zcache-main.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
> index dcceed2..81972fa 100644
> --- a/drivers/staging/zcache/zcache-main.c
> +++ b/drivers/staging/zcache/zcache-main.c
> @@ -1811,10 +1811,12 @@ static int zcache_comp_init(void)
>  #else
>  	if (*zcache_comp_name != '\0') {
>  		ret = crypto_has_comp(zcache_comp_name, 0, 0);
> -		if (!ret)
> +		if (!ret) {
>  			pr_info("zcache: %s not supported\n",
>  					zcache_comp_name);
> -		goto out;
> +			ret = 1;
> +			goto out;
> +		}
>  	}
>  	if (!ret)
>  		strcpy(zcache_comp_name, "lzo");
> -- 
> 1.7.9.5
> 

  reply	other threads:[~2013-07-19 15:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 14:46 [PATCH] zcache: fix "zcache=" kernel parameter Piotr Sarna
2013-07-19 15:20 ` Konrad Rzeszutek Wilk [this message]
2013-07-24 10:02 ` Michal Hocko
2013-07-24 10:04   ` Michal Hocko
2013-07-24 10:32     ` Bartlomiej Zolnierkiewicz
2013-07-24 11:41       ` Michal Hocko
2013-07-24 11:54         ` Bartlomiej Zolnierkiewicz
2013-07-24 15:04           ` Greg KH
2013-07-24 15:06           ` Greg KH
2013-07-24 15:39             ` Bartlomiej Zolnierkiewicz
2013-07-24 15:50               ` Bartlomiej Zolnierkiewicz
2013-07-24 16:48                 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2013-07-18 11:09 Piotr Sarna

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=20130719152016.GA13009@localhost.localdomain \
    --to=konrad.wilk@oracle.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=bob.liu@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.sarna@partner.samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).