Re: [PATCH] crypto: zip - Memory corruption in zip_clear_stats()

2017-03-20 Thread Mahipal Reddy
On Sat, Mar 18, 2017 at 4:29 PM, Dan Carpenter  wrote:
> On Sat, Mar 18, 2017 at 11:24:34AM +0100, walter harms wrote:
>>
>>
>> Am 17.03.2017 21:46, schrieb Dan Carpenter:
>> > There is a typo here.  It should be "stats" instead of "state".  The
>> > impact is that we clear 224 bytes instead of 80 and we zero out memory
>> > that we shouldn't.

Thank you Dan for identifying the issue. Yes there is a typo and it needs a fix.


>> > Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression 
>> > statistics")
>> > Signed-off-by: Dan Carpenter 
>> >
>> > diff --git a/drivers/crypto/cavium/zip/zip_main.c 
>> > b/drivers/crypto/cavium/zip/zip_main.c
>> > index 0951e20b395b..6ff13d80d82e 100644
>> > --- a/drivers/crypto/cavium/zip/zip_main.c
>> > +++ b/drivers/crypto/cavium/zip/zip_main.c
>> > @@ -530,7 +530,7 @@ static int zip_clear_stats(struct seq_file *s, void 
>> > *unused)
>> > for (index = 0; index < MAX_ZIP_DEVICES; index++) {
>> > if (zip_dev[index]) {
>> > memset(_dev[index]->stats, 0,
>> > -  sizeof(struct zip_state));
>> > +  sizeof(struct zip_stats));

Yes this resolves the issue.
Thanks for this fix.
Mahipal

>>
>> as future FIXME some show find a name that differ in more than just the last 
>> char.
>> NTL maybe
>>  sizeof(zip_dev[index]->stats)
>> can be used here ?
>
> That's sort of unweildy.  I don't fear that change because I'm confident
> I would catch it with static analysis.
>
> regards,
> dan carpenter
>


Re: [RFC PATCH v2 0/3] Cavium ThunderX ZIP driver

2017-03-09 Thread Mahipal Reddy
On Thu, Mar 9, 2017 at 4:16 PM, Herbert Xu  wrote:
> On Wed, Feb 15, 2017 at 10:45:07AM +0530, Mahipal Challa wrote:
>> Hi Herbert,
>>
>> This series adds support for hardware accelerated compression & decompression
>> as found on ThunderX (arm64) SOCs.
>>
>> As per your suggestion, we've switched to the new crypto acomp/scomp 
>> interface.
>>
>> To test the ZIP driver, we modified the kernel's ZSWAP to use acomp API's.
>>
>> Performance numbers from ZSWAP look promising.
>> The "average time" for compressing a 4KB page:
>>
>> Compression Software: 278 usec
>> Compression HW deflate  :  17 usec
>> Compression HW LZS  :  11 usec
>>
>> Decompression Software  : 20 usec
>> Decompression HW deflate:  8 usec
>> Decompression HW LZS:  6 usec
>>
>> Addressed the review comments from the RFC v1.
>>  - Added acomp/scomp crypto interface support.
>>  - Improved the error handling.
>>  - ZIP command completion codes are renamed suitably.
>>  - Removed some un-used code.
>>  - raw_smp_processor_id() replaced with smp_processor_id().
>>  - Some more miscellaneous changes.
>>
>> Patches are on top of "kernel/git/herbert/crypto-2.6.git" repository
>>
>> Please provide your feedback.
>
> All applied.  Thanks.
> --
> Email: Herbert Xu 
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Thank you Herbert.

Regards,
-Mahipal