]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
crypto: zip - Memory corruption in zip_clear_stats()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 17 Mar 2017 20:46:21 +0000 (23:46 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 24 Mar 2017 14:03:00 +0000 (22:03 +0800)
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.

Fixes: 09ae5d37e093 ("crypto: zip - Add Compression/Decompression statistics")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/cavium/zip/zip_main.c

index 0951e20b395b61856829ad7c25b7ecb333ffe0da..6ff13d80d82ea04ff0770b8acf8e528f84eed979 100644 (file)
@@ -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(&zip_dev[index]->stats, 0,
-                              sizeof(struct zip_state));
+                              sizeof(struct zip_stats));
                        seq_printf(s, "Cleared stats for zip %d\n", index);
                }
        }