Re: Re: [PATCH] zcache: fix "zcache=" kernel parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wednesday, July 24, 2013 12:04:41 PM Michal Hocko wrote:
> On Wed 24-07-13 12:02:35, Michal Hocko wrote:
> > I have posted a similar fix quite some time ago and I guess Greg should
> > already have it.
> 
> For reference https://lkml.org/lkml/2013/6/26/410

There was a reply from Greg:

	https://lkml.org/lkml/2013/6/26/410
 
and it seems that Greg's request has not been fullfilled.

Anyway Piotr's patch seems to be more complete:
- it also fixes case in which invalid "zcache=" option is given (returns
  an error value 1 while with your patch the code still erronously retuns 0)
- it prints information about compressor type being used when "zcache="
  option is used (your patch skips it due to addition of "goto out_alloc")

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> > Greg?
> > 
> > On Fri 19-07-13 16:46:41, 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@xxxxxxxxxxxxxxxxxxx>
> > > Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
> > > Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> > > ---
> > >  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");

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux