[PATCH] crypto: nx: fix spelling mistake: "seqeunce" -> "sequence"

2018-05-09 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in CSB_ERR error message text

Signed-off-by: Colin Ian King 
---
 drivers/crypto/nx/nx-842-powernv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/nx/nx-842-powernv.c 
b/drivers/crypto/nx/nx-842-powernv.c
index 1e87637c412d..36afd6d8753c 100644
--- a/drivers/crypto/nx/nx-842-powernv.c
+++ b/drivers/crypto/nx/nx-842-powernv.c
@@ -334,7 +334,7 @@ static int wait_for_csb(struct nx842_workmem *wmem,
return -EPROTO;
case CSB_CC_SEQUENCE:
/* should not happen, we don't use chained CRBs */
-   CSB_ERR(csb, "CRB seqeunce number error");
+   CSB_ERR(csb, "CRB sequence number error");
return -EPROTO;
case CSB_CC_UNKNOWN_CODE:
CSB_ERR(csb, "Unknown subfunction code");
-- 
2.17.0



[PATCH] hwrng: n2: fix spelling mistake: "restesting" -> "retesting"

2018-05-08 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in dev_err error message

Signed-off-by: Colin Ian King 
---
 drivers/char/hw_random/n2-drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c
index 92dd4e925315..f8411515fe1c 100644
--- a/drivers/char/hw_random/n2-drv.c
+++ b/drivers/char/hw_random/n2-drv.c
@@ -435,7 +435,7 @@ static int n2rng_data_read(struct hwrng *rng, u32 *data)
*data = np->test_data & 0x;
len = 4;
} else {
-   dev_err(>op->dev, "RNG error, restesting\n");
+   dev_err(>op->dev, "RNG error, retesting\n");
np->flags &= ~N2RNG_FLAG_READY;
if (!(np->flags & N2RNG_FLAG_SHUTDOWN))
schedule_delayed_work(>work, 0);
-- 
2.17.0



[PATCH] crypto: ghash-clmulni: fix spelling mistake: "acclerated" -> "accelerated"

2018-04-27 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in module description text

Signed-off-by: Colin Ian King 
---
 arch/x86/crypto/ghash-clmulni-intel_glue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c 
b/arch/x86/crypto/ghash-clmulni-intel_glue.c
index 0420bab19efb..2ddbe3a1868b 100644
--- a/arch/x86/crypto/ghash-clmulni-intel_glue.c
+++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c
@@ -364,5 +364,5 @@ module_exit(ghash_pclmulqdqni_mod_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("GHASH Message Digest Algorithm, "
-  "acclerated by PCLMULQDQ-NI");
+  "accelerated by PCLMULQDQ-NI");
 MODULE_ALIAS_CRYPTO("ghash");
-- 
2.17.0



[PATCH][next] crypto: chtls: remove redundant assignment to cdev->ports

2018-04-06 Thread Colin King
From: Colin Ian King 

There is a double assignment to cdev->ports, the first is redundant
as it is over-written so remove it.

Detected by CoverityScan, CID#1467432 ("Unused value")

Signed-off-by: Colin Ian King 
---
 drivers/crypto/chelsio/chtls/chtls_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c 
b/drivers/crypto/chelsio/chtls/chtls_main.c
index 007c45c38fc7..984a53f19f8b 100644
--- a/drivers/crypto/chelsio/chtls/chtls_main.c
+++ b/drivers/crypto/chelsio/chtls/chtls_main.c
@@ -216,7 +216,6 @@ static void *chtls_uld_add(const struct cxgb4_lld_info 
*info)
cdev->lldi = lldi;
cdev->pdev = lldi->pdev;
cdev->tids = lldi->tids;
-   cdev->ports = (struct net_device **)(cdev + 1);
cdev->ports = lldi->ports;
cdev->mtus = lldi->mtus;
cdev->tids = lldi->tids;
-- 
2.15.1



[PATCH][next] crypto: chtls: don't leak information from the stack to userspace

2018-04-05 Thread Colin King
From: Colin Ian King 

The structure crypto_info contains fields that are not initialized and
only .version is set.  The copy_to_user call is hence leaking information
from the stack to userspace which must be avoided. Fix this by zero'ing
all the unused fields.

Detected by CoverityScan, CID#1467421 ("Uninitialized scalar variable")

Fixes: a08943947873 ("crypto: chtls - Register chtls with net tls")
Signed-off-by: Colin Ian King 
---
 drivers/crypto/chelsio/chtls/chtls_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c 
b/drivers/crypto/chelsio/chtls/chtls_main.c
index 007c45c38fc7..69f3756eb980 100644
--- a/drivers/crypto/chelsio/chtls/chtls_main.c
+++ b/drivers/crypto/chelsio/chtls/chtls_main.c
@@ -441,7 +441,7 @@ static int chtls_uld_rx_handler(void *handle, const __be64 
*rsp,
 static int do_chtls_getsockopt(struct sock *sk, char __user *optval,
   int __user *optlen)
 {
-   struct tls_crypto_info crypto_info;
+   struct tls_crypto_info crypto_info = { 0 };
 
crypto_info.version = TLS_1_2_VERSION;
if (copy_to_user(optval, _info, sizeof(struct tls_crypto_info)))
-- 
2.15.1



[PATCH][next] crypto: x86/des3_ede: make array des3_ede_skciphers static

2018-03-05 Thread Colin King
From: Colin Ian King 

The array des3_ede_skciphers is local to the source and does not need
to be in global scope, so make it static.

Cleans up sparse warning:
arch/x86/crypto/des3_ede_glue.c:407:21: warning: symbol
'des3_ede_skciphers' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 arch/x86/crypto/des3_ede_glue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/des3_ede_glue.c b/arch/x86/crypto/des3_ede_glue.c
index f9c7bdc5be5a..5c610d4ef9fc 100644
--- a/arch/x86/crypto/des3_ede_glue.c
+++ b/arch/x86/crypto/des3_ede_glue.c
@@ -404,7 +404,7 @@ static struct crypto_alg des3_ede_cipher = {
}
 };
 
-struct skcipher_alg des3_ede_skciphers[] = {
+static struct skcipher_alg des3_ede_skciphers[] = {
{
.base.cra_name  = "ecb(des3_ede)",
.base.cra_driver_name   = "ecb-des3_ede-asm",
-- 
2.15.1



[PATCH] hwrng: cavium: make two functions static

2018-02-26 Thread Colin King
From: Colin Ian King 

Functions cavium_rng_remove and cavium_rng_remove_vf are local to the
source and do not need to be in global scope, so make them static.

Cleans up sparse warnings:
drivers/char/hw_random/cavium-rng-vf.c:80:7: warning: symbol
'cavium_rng_remove_vf' was not declared. Should it be static?
drivers/char/hw_random/cavium-rng.c:65:7: warning: symbol
'cavium_rng_remove' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/char/hw_random/cavium-rng-vf.c | 2 +-
 drivers/char/hw_random/cavium-rng.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/cavium-rng-vf.c 
b/drivers/char/hw_random/cavium-rng-vf.c
index dd1007aecb10..2d1352b67168 100644
--- a/drivers/char/hw_random/cavium-rng-vf.c
+++ b/drivers/char/hw_random/cavium-rng-vf.c
@@ -77,7 +77,7 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev,
 }
 
 /* Remove the VF */
-void  cavium_rng_remove_vf(struct pci_dev *pdev)
+static void  cavium_rng_remove_vf(struct pci_dev *pdev)
 {
struct cavium_rng *rng;
 
diff --git a/drivers/char/hw_random/cavium-rng.c 
b/drivers/char/hw_random/cavium-rng.c
index a944e0a47f42..63d6e68c24d2 100644
--- a/drivers/char/hw_random/cavium-rng.c
+++ b/drivers/char/hw_random/cavium-rng.c
@@ -62,7 +62,7 @@ static int cavium_rng_probe(struct pci_dev *pdev,
 }
 
 /* Disable VF and RNG Hardware */
-void  cavium_rng_remove(struct pci_dev *pdev)
+static void cavium_rng_remove(struct pci_dev *pdev)
 {
struct cavium_rng_pf *rng;
 
-- 
2.15.1



[PATCH] crypto: qat - Make several functions static

2018-02-06 Thread Colin King
From: Colin Ian King 

Functions qat_rsa_set_n, qat_rsa_set_e and qat_rsa_set_n are local to
the source and do not need to be in global scope, so make them static.

Cleans up sparse warnings:
drivers/crypto/qat/qat_common/qat_asym_algs.c:972:5: warning: symbol
'qat_rsa_set_n' was not declared. Should it be static?
drivers/crypto/qat/qat_common/qat_asym_algs.c:1003:5: warning: symbol
'qat_rsa_set_e' was not declared. Should it be static?
drivers/crypto/qat/qat_common/qat_asym_algs.c:1027:5: warning: symbol
'qat_rsa_set_d' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/crypto/qat/qat_common/qat_asym_algs.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c 
b/drivers/crypto/qat/qat_common/qat_asym_algs.c
index 13c52d6bf630..320e7854b4ee 100644
--- a/drivers/crypto/qat/qat_common/qat_asym_algs.c
+++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c
@@ -969,7 +969,8 @@ static int qat_rsa_dec(struct akcipher_request *req)
return ret;
 }
 
-int qat_rsa_set_n(struct qat_rsa_ctx *ctx, const char *value, size_t vlen)
+static int qat_rsa_set_n(struct qat_rsa_ctx *ctx, const char *value,
+size_t vlen)
 {
struct qat_crypto_instance *inst = ctx->inst;
struct device *dev = _DEV(inst->accel_dev);
@@ -1000,7 +1001,8 @@ int qat_rsa_set_n(struct qat_rsa_ctx *ctx, const char 
*value, size_t vlen)
return ret;
 }
 
-int qat_rsa_set_e(struct qat_rsa_ctx *ctx, const char *value, size_t vlen)
+static int qat_rsa_set_e(struct qat_rsa_ctx *ctx, const char *value,
+size_t vlen)
 {
struct qat_crypto_instance *inst = ctx->inst;
struct device *dev = _DEV(inst->accel_dev);
@@ -1024,7 +1026,8 @@ int qat_rsa_set_e(struct qat_rsa_ctx *ctx, const char 
*value, size_t vlen)
return 0;
 }
 
-int qat_rsa_set_d(struct qat_rsa_ctx *ctx, const char *value, size_t vlen)
+static int qat_rsa_set_d(struct qat_rsa_ctx *ctx, const char *value,
+size_t vlen)
 {
struct qat_crypto_instance *inst = ctx->inst;
struct device *dev = _DEV(inst->accel_dev);
-- 
2.15.1



[PATCH] crypto: ccp - Make function ccp_get_dma_chan_attr static

2018-02-06 Thread Colin King
From: Colin Ian King 

Function ccp_get_dma_chan_attr is local to the source and does not
need to be in global scope, so make it static.

Cleans up sparse warning:
drivers/crypto/ccp/ccp-dmaengine.c:41:14: warning: symbol
'ccp_get_dma_chan_attr' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/crypto/ccp/ccp-dmaengine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/ccp/ccp-dmaengine.c 
b/drivers/crypto/ccp/ccp-dmaengine.c
index 8b9da58459df..67155cb21636 100644
--- a/drivers/crypto/ccp/ccp-dmaengine.c
+++ b/drivers/crypto/ccp/ccp-dmaengine.c
@@ -38,7 +38,7 @@ static unsigned int dma_chan_attr = CCP_DMA_DFLT;
 module_param(dma_chan_attr, uint, 0444);
 MODULE_PARM_DESC(dma_chan_attr, "Set DMA channel visibility: 0 (default) = 
device defaults, 1 = make private, 2 = make public");
 
-unsigned int ccp_get_dma_chan_attr(struct ccp_device *ccp)
+static unsigned int ccp_get_dma_chan_attr(struct ccp_device *ccp)
 {
switch (dma_chan_attr) {
case CCP_DMA_DFLT:
-- 
2.15.1



[PATCH] crypto: chelsio - Make function aead_ccm_validate_input static

2018-02-06 Thread Colin King
From: Colin Ian King 

Function aead_ccm_validate_input is local to the source and does not
need to be in global scope, so make it static.

Cleans up sparse warning:
drivers/crypto/chelsio/chcr_algo.c:2627:5: warning: symbol
'aead_ccm_validate_input' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/crypto/chelsio/chcr_algo.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c 
b/drivers/crypto/chelsio/chcr_algo.c
index 34a02d690548..8a67884512e4 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -2636,10 +2636,10 @@ static void fill_sec_cpl_for_aead(struct cpl_tx_sec_pdu 
*sec_cpl,
0, dst_size);
 }
 
-int aead_ccm_validate_input(unsigned short op_type,
-   struct aead_request *req,
-   struct chcr_aead_ctx *aeadctx,
-   unsigned int sub_type)
+static int aead_ccm_validate_input(unsigned short op_type,
+  struct aead_request *req,
+  struct chcr_aead_ctx *aeadctx,
+  unsigned int sub_type)
 {
if (sub_type != CRYPTO_ALG_SUB_TYPE_AEAD_RFC4309) {
if (crypto_ccm_check_iv(req->iv)) {
-- 
2.15.1



[PATCH][next] hwrng: exynos: check for -ve error return from readl_poll_timeout

2018-01-12 Thread Colin King
From: Colin Ian King 

Currently, the return from readl_poll_timeout is being assigned to
a u32 and this is being checked for a -ve return which is always
false since a u32 cannot be less than zero.  Fix this by changing
val to an int so that error returns can be correctly detected.

Detected by CoverityScan, CID#1463776 ("Logically dead code")

Fixes: 6cd225cc5d8a ("hwrng: exynos - add Samsung Exynos True RNG driver")
Signed-off-by: Colin Ian King 
---
 drivers/char/hw_random/exynos-trng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/exynos-trng.c 
b/drivers/char/hw_random/exynos-trng.c
index 34d6f51ecbee..f4643e3ec346 100644
--- a/drivers/char/hw_random/exynos-trng.c
+++ b/drivers/char/hw_random/exynos-trng.c
@@ -55,7 +55,7 @@ static int exynos_trng_do_read(struct hwrng *rng, void *data, 
size_t max,
   bool wait)
 {
struct exynos_trng_dev *trng;
-   u32 val;
+   int val;
 
max = min_t(size_t, max, (EXYNOS_TRNG_FIFO_LEN * 4));
 
-- 
2.15.1



[PATCH][next] staging: ccree: fix memory leaks in cc_ivgen_init

2018-01-12 Thread Colin King
From: Colin Ian King 

The current error exit path in function cc_ivgen_init via label
'out' free's resources from the drvdata->ivgen_handle context.
However, drvdata->ivgen_handle has not been assigned to the
context ivgen_ctx at this point, so the resources are not freed.
Fix this by setting drvdata->ivgen_handle to ivgen_ctx as early
as possible so that the clean up error exit return path can free
the resources.

Detected by CoveritScan, CID#1463795 ("Resource leak")

Signed-off-by: Colin Ian King 
---
 drivers/staging/ccree/cc_ivgen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ccree/cc_ivgen.c b/drivers/staging/ccree/cc_ivgen.c
index 25a3131a93ce..c47f419b277b 100644
--- a/drivers/staging/ccree/cc_ivgen.c
+++ b/drivers/staging/ccree/cc_ivgen.c
@@ -178,6 +178,8 @@ int cc_ivgen_init(struct cc_drvdata *drvdata)
if (!ivgen_ctx)
return -ENOMEM;
 
+   drvdata->ivgen_handle = ivgen_ctx;
+
/* Allocate pool's header for initial enc. key/IV */
ivgen_ctx->pool_meta = dma_alloc_coherent(device, CC_IVPOOL_META_SIZE,
  _ctx->pool_meta_dma,
@@ -196,8 +198,6 @@ int cc_ivgen_init(struct cc_drvdata *drvdata)
goto out;
}
 
-   drvdata->ivgen_handle = ivgen_ctx;
-
return cc_init_iv_sram(drvdata);
 
 out:
-- 
2.15.1



[PATCH] crypto: tcrypt - free xoutbuf instead of axbuf

2018-01-02 Thread Colin King
From: Colin Ian King 

There seems to be a cut-n-paste bug with the name of the buffer being
free'd, xoutbuf should be used instead of axbuf.

Detected by CoverityScan, CID#1463420 ("Copy-paste error")

Fixes: 427988d981c4 ("crypto: tcrypt - add multibuf aead speed test")
Signed-off-by: Colin Ian King 
---
 crypto/tcrypt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index f61d2f40dd90..14213a096fd2 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -298,7 +298,7 @@ static void test_mb_aead_speed(const char *algo, int enc, 
int secs,
for (i = 0; i < num_mb; ++i)
if (testmgr_alloc_buf(data[i].xoutbuf)) {
while (i--)
-   testmgr_free_buf(data[i].axbuf);
+   testmgr_free_buf(data[i].xoutbuf);
goto out_free_axbuf;
}
 
-- 
2.14.1



[PATCH][crypto-next] crypto: inside-secure - make function safexcel_try_push_requests static

2018-01-02 Thread Colin King
From: Colin Ian King 

The function safexcel_try_push_requests  is local to the source and does
not need to be in global scope, so make it static.

Cleans up sparse warning:
symbol 'safexcel_try_push_requests' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/crypto/inside-secure/safexcel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/inside-secure/safexcel.c 
b/drivers/crypto/inside-secure/safexcel.c
index 0d685be75241..e3745139644b 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -432,8 +432,8 @@ static int safexcel_hw_init(struct safexcel_crypto_priv 
*priv)
 }
 
 /* Called with ring's lock taken */
-int safexcel_try_push_requests(struct safexcel_crypto_priv *priv, int ring,
-  int reqs)
+static int safexcel_try_push_requests(struct safexcel_crypto_priv *priv,
+int ring, int reqs)
 {
int coal = min_t(int, reqs, EIP197_MAX_BATCH_SZ);
 
-- 
2.14.1



[PATCH][crypto-next] crypto: tcrypt: fix spelling mistake: "bufufer"-> "buffer"

2018-01-02 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistakes in pr_err error message text.

Signed-off-by: Colin Ian King 
---
 crypto/tcrypt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 58e3344d7169..f61d2f40dd90 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -328,7 +328,7 @@ static void test_mb_aead_speed(const char *algo, int enc, 
int secs,
b_size = aead_sizes;
do {
if (*b_size + authsize > XBUFSIZE * PAGE_SIZE) {
-   pr_err("template (%u) too big for bufufer 
(%lu)\n",
+   pr_err("template (%u) too big for buffer 
(%lu)\n",
   authsize + *b_size,
   XBUFSIZE * PAGE_SIZE);
goto out;
@@ -1269,7 +1269,7 @@ static void test_mb_skcipher_speed(const char *algo, int 
enc, int secs,
b_size = block_sizes;
do {
if (*b_size > XBUFSIZE * PAGE_SIZE) {
-   pr_err("template (%u) too big for bufufer 
(%lu)\n",
+   pr_err("template (%u) too big for buffer 
(%lu)\n",
   *b_size, XBUFSIZE * PAGE_SIZE);
goto out;
}
-- 
2.14.1



[PATCH] chcr: ensure cntrl is initialized to fix bit-wise or'ing of garabage data

2017-11-30 Thread Colin King
From: Colin Ian King 

In the case where skb->ip_summed != CHECKSUM_PARTIAL then cntrl contains
garbage value and this is possibly being bit-wise or'd and stored into
cpl->ctrl1.  Fix this by initializing cntrl to zero.

Cleans up clang warning:
drivers/crypto/chelsio/chcr_ipsec.c:374:9: warning: The left expression
of the compound assignment is an uninitialized value. The computed value
will also be garbage

Fixes: 6dad4e8ab3ec ("chcr: Add support for Inline IPSec")
Signed-off-by: Colin Ian King 
---
 drivers/crypto/chelsio/chcr_ipsec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_ipsec.c 
b/drivers/crypto/chelsio/chcr_ipsec.c
index a0f003ffd1f4..64a030f8fb21 100644
--- a/drivers/crypto/chelsio/chcr_ipsec.c
+++ b/drivers/crypto/chelsio/chcr_ipsec.c
@@ -350,7 +350,7 @@ inline void *copy_cpltx_pktxt(struct sk_buff *skb,
struct port_info *pi;
struct sge_eth_txq *q;
struct cpl_tx_pkt_core *cpl;
-   u64 cntrl;
+   u64 cntrl = 0;
u32 ctrl0, qidx;
 
pi = netdev_priv(dev);
-- 
2.14.1



[PATCH] chcr: remove unused variables net_device, pi, adap and cntrl

2017-11-30 Thread Colin King
From: Colin Ian King 

Variables adap, pi and cntrl are assigned but are never read, hence
they are redundant and can be removed.

Cleans up various clang build warnings.

Signed-off-by: Colin Ian King 
---
 drivers/crypto/chelsio/chcr_ipsec.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_ipsec.c 
b/drivers/crypto/chelsio/chcr_ipsec.c
index f90f991c133f..a0f003ffd1f4 100644
--- a/drivers/crypto/chelsio/chcr_ipsec.c
+++ b/drivers/crypto/chelsio/chcr_ipsec.c
@@ -199,14 +199,9 @@ static inline int chcr_ipsec_setkey(struct xfrm_state *x,
  */
 static int chcr_xfrm_add_state(struct xfrm_state *x)
 {
-   struct net_device *netdev = x->xso.dev;
-   struct port_info *pi  = netdev_priv(netdev);
struct ipsec_sa_entry *sa_entry;
-   struct adapter *adap;
int res = 0;
 
-   adap = pi->adapter;
-
if (x->props.aalgo != SADB_AALG_NONE) {
pr_debug("CHCR: Cannot offload authenticated xfrm states\n");
return -EINVAL;
@@ -570,7 +565,7 @@ int chcr_ipsec_xmit(struct sk_buff *skb, struct net_device 
*dev)
 {
struct xfrm_state *x = xfrm_input_state(skb);
struct ipsec_sa_entry *sa_entry;
-   u64 *pos, *end, *before, cntrl, *sgl;
+   u64 *pos, *end, *before, *sgl;
int qidx, left, credits;
unsigned int flits = 0, ndesc, kctx_len;
struct adapter *adap;
@@ -596,7 +591,6 @@ out_free:   dev_kfree_skb_any(skb);
q = >sge.ethtxq[qidx + pi->first_qset];
 
cxgb4_reclaim_completed_tx(adap, >q, true);
-   cntrl = TXPKT_L4CSUM_DIS_F | TXPKT_IPCSUM_DIS_F;
 
flits = calc_tx_sec_flits(skb, sa_entry->kctx_len);
ndesc = flits_to_desc(flits);
-- 
2.14.1



[PATCH] crypto: chelsio: make arrays sgl_ent_len and dsgl_ent_len static

2017-11-30 Thread Colin King
From: Colin Ian King 

The arrays sgl_ent_len and dsgl_ent_len are local to the source and do
not need to be in global scope, so make them static. Also re-format the
declarations to match the following round_constant array declaration
style.

Cleans up sparse warnings:
drivers/crypto/chelsio/chcr_algo.c:76:14: warning: symbol 'sgl_ent_len'
was not declared. Should it be static?
drivers/crypto/chelsio/chcr_algo.c:81:14: warning: symbol 'dsgl_ent_len'
was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/crypto/chelsio/chcr_algo.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c 
b/drivers/crypto/chelsio/chcr_algo.c
index e61ec8a46340..b663b93b7d01 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -73,15 +73,19 @@
 
 #define IV AES_BLOCK_SIZE
 
-unsigned int sgl_ent_len[] = {0, 0, 16, 24, 40, 48, 64, 72, 88,
-   96, 112, 120, 136, 144, 160, 168, 184,
-   192, 208, 216, 232, 240, 256, 264, 280,
-   288, 304, 312, 328, 336, 352, 360, 376};
-
-unsigned int dsgl_ent_len[] = {0, 32, 32, 48, 48, 64, 64, 80, 80,
-   112, 112, 128, 128, 144, 144, 160, 160,
-   192, 192, 208, 208, 224, 224, 240, 240,
-   272, 272, 288, 288, 304, 304, 320, 320};
+static unsigned int sgl_ent_len[] = {
+   0, 0, 16, 24, 40, 48, 64, 72, 88,
+   96, 112, 120, 136, 144, 160, 168, 184,
+   192, 208, 216, 232, 240, 256, 264, 280,
+   288, 304, 312, 328, 336, 352, 360, 376
+};
+
+static unsigned int dsgl_ent_len[] = {
+   0, 32, 32, 48, 48, 64, 64, 80, 80,
+   112, 112, 128, 128, 144, 144, 160, 160,
+   192, 192, 208, 208, 224, 224, 240, 240,
+   272, 272, 288, 288, 304, 304, 320, 320
+};
 
 static u32 round_constant[11] = {
0x0100, 0x0200, 0x0400, 0x0800,
-- 
2.14.1



[PATCH] crypto: cryptd: make cryptd_max_cpu_qlen module parameter static

2017-11-30 Thread Colin King
From: Colin Ian King 

The cryptd_max_cpu_qlen module parameter is local to the source and does
not need to be in global scope, so make it static.

Cleans up sparse warning:
crypto/cryptd.c:35:14: warning: symbol 'cryptd_max_cpu_qlen' was not
declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 crypto/cryptd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index b1eb131c0f10..552e3a86e829 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -32,7 +32,7 @@
 #include 
 #include 
 
-unsigned int cryptd_max_cpu_qlen = 1000;
+static unsigned int cryptd_max_cpu_qlen = 1000;
 module_param(cryptd_max_cpu_qlen, uint, 0);
 MODULE_PARM_DESC(cryptd_max_cpu_qlen, "Set cryptd Max queue depth");
 
-- 
2.14.1



[PATCH] staging: ccree: fix incorrect indentation of break statement

2017-11-17 Thread Colin King
From: Colin Ian King 

The break statement is indented one level too many, fix this.

Signed-off-by: Colin Ian King 
---
 drivers/staging/ccree/ssi_aead.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index ba0954e4d2e5..446da9d47cd9 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -2108,7 +2108,7 @@ static int ssi_aead_process(struct aead_request *req, 
enum drv_crypto_direction
if (ctx->cipher_mode == DRV_CIPHER_GCTR)
ssi_aead_gcm(req, desc, _len);
 #endif /*SSI_CC_HAS_AES_GCM*/
-   break;
+   break;
 #endif
default:
dev_err(dev, "Unsupported authenc (%d)\n", ctx->auth_mode);
-- 
2.14.1



[PATCH] crypto: cavium: fix memory leak on info

2017-11-15 Thread Colin King
From: Colin Ian King 

The object info is being leaked on an error return path, fix this
by setting ret to -ENOMEM and exiting via the request_cleanup path
that will free info.

Detected by CoverityScan, CID#1408439 ("Resource Leak")

Fixes: c694b233295b ("crypto: cavium - Add the Virtual Function driver for CPT")
Signed-off-by: Colin Ian King 
---
 drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c 
b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
index 169e66231bcf..b0ba4331944b 100644
--- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
+++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
@@ -459,7 +459,8 @@ int process_request(struct cpt_vf *cptvf, struct 
cpt_request_info *req)
info->completion_addr = kzalloc(sizeof(union cpt_res_s), GFP_KERNEL);
if (unlikely(!info->completion_addr)) {
dev_err(>dev, "Unable to allocate memory for 
completion_addr\n");
-   return -ENOMEM;
+   ret = -ENOMEM;
+   goto request_cleanup;
}
 
result = (union cpt_res_s *)info->completion_addr;
-- 
2.14.1



[PATCH] crypto/nx: fix spelling mistake: "availavle" -> "available"

2017-11-14 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in pr_err error message text

Signed-off-by: Colin Ian King 
---
 drivers/crypto/nx/nx-842-powernv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/nx/nx-842-powernv.c 
b/drivers/crypto/nx/nx-842-powernv.c
index f2246a5abcf6..9c01d11f255a 100644
--- a/drivers/crypto/nx/nx-842-powernv.c
+++ b/drivers/crypto/nx/nx-842-powernv.c
@@ -744,7 +744,7 @@ static int nx842_open_percpu_txwins(void)
 
if (!per_cpu(cpu_txwin, i)) {
/* shoudn't happen, Each chip will have NX engine */
-   pr_err("NX engine is not availavle for CPU %d\n", i);
+   pr_err("NX engine is not available for CPU %d\n", i);
return -EINVAL;
}
}
-- 
2.14.1



[PATCH] crypto: chelsio: remove redundant assignments to reqctx and dst_size

2017-11-09 Thread Colin King
From: Colin Ian King 

Pointer reqctx is assigned the same value twice, once on initialization
and again a few statements later, remove the second redundant assignment.
Variable dst_size is assigned but it is never read, so the variable is
redundant and can be removed. Cleans up clang warnings:

drivers/crypto/chelsio/chcr_algo.c:156:29: warning: Value stored to
'reqctx' during its initialization is never read
drivers/crypto/chelsio/chcr_algo.c:2020:2: warning: Value stored to
'dst_size' is never read

Signed-off-by: Colin Ian King 
---
 drivers/crypto/chelsio/chcr_algo.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c 
b/drivers/crypto/chelsio/chcr_algo.c
index 4eed7171e2ae..300e66fe8a3c 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -160,7 +160,6 @@ static inline void chcr_handle_ahash_resp(struct 
ahash_request *req,
 
if (input == NULL)
goto out;
-   reqctx = ahash_request_ctx(req);
digestsize = crypto_ahash_digestsize(crypto_ahash_reqtfm(req));
if (reqctx->is_sg_map)
chcr_hash_dma_unmap(_ctx->lldi.pdev->dev, req);
@@ -2014,11 +2013,8 @@ static int chcr_aead_common_init(struct aead_request 
*req,
struct chcr_aead_ctx *aeadctx = AEAD_CTX(a_ctx(tfm));
struct chcr_aead_reqctx  *reqctx = aead_request_ctx(req);
int error = -EINVAL;
-   unsigned int dst_size;
unsigned int authsize = crypto_aead_authsize(tfm);
 
-   dst_size = req->assoclen + req->cryptlen + (op_type ?
-   -authsize : authsize);
/* validate key size */
if (aeadctx->enckey_len == 0)
goto err;
-- 
2.14.1



[PATCH] staging: ccree: remove unused pointer cc_base

2017-11-09 Thread Colin King
From: Colin Ian King 

Pointer cc_base is being assigned but is never read, hence it is
redundant and can be removed. Cleans up clang warning:

drivers/staging/ccree/ssi_driver.c:235:2: warning: Value stored to
'cc_base' is never read

Signed-off-by: Colin Ian King 
---
 drivers/staging/ccree/ssi_driver.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index 1a3c481fa92a..f4c0af8047e4 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -199,7 +199,6 @@ int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe)
 static int init_cc_resources(struct platform_device *plat_dev)
 {
struct resource *req_mem_cc_regs = NULL;
-   void __iomem *cc_base = NULL;
struct ssi_drvdata *new_drvdata;
struct device *dev = _dev->dev;
struct device_node *np = dev->of_node;
@@ -232,8 +231,6 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
dev_dbg(dev, "CC registers mapped from %pa to 0x%p\n",
_mem_cc_regs->start, new_drvdata->cc_base);
 
-   cc_base = new_drvdata->cc_base;
-
/* Then IRQ */
new_drvdata->irq = platform_get_irq(plat_dev, 0);
if (new_drvdata->irq < 0) {
-- 
2.14.1



[PATCH] crypto: qat: remove unused and redundant pointer vf_info

2017-10-12 Thread Colin King
From: Colin Ian King 

The pointer vf_info is being assigned but never read, it is redundant
and therefore can be removed.

Cleans up clang warning: Value stored to 'vf_info' is never read

Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV")
Signed-off-by: Colin Ian King 
---
 drivers/crypto/qat/qat_common/adf_dev_mgr.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/adf_dev_mgr.c 
b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
index 8afac52677a6..2d06409bd3c4 100644
--- a/drivers/crypto/qat/qat_common/adf_dev_mgr.c
+++ b/drivers/crypto/qat/qat_common/adf_dev_mgr.c
@@ -228,11 +228,8 @@ int adf_devmgr_add_dev(struct adf_accel_dev *accel_dev,
list_add_tail(>list, _table);
} else if (accel_dev->is_vf && pf) {
/* VF on host */
-   struct adf_accel_vf_info *vf_info;
struct vf_id_map *map;
 
-   vf_info = pf->pf.vf_info + adf_get_vf_id(accel_dev);
-
map = adf_find_vf(adf_get_vf_num(accel_dev));
if (map) {
struct vf_id_map *next;
-- 
2.14.1



[PATCH] crypto: ccp: remove unused variable qim

2017-10-12 Thread Colin King
From: Colin Ian King 

Variable qim is assigned but never read, it is redundant and can
be removed.

Cleans up clang warning: Value stored to 'qim' is never read

Fixes: 4b394a232df7 ("crypto: ccp - Let a v5 CCP provide the same function as 
v3")
Signed-off-by: Colin Ian King 
---
 drivers/crypto/ccp/ccp-dev-v5.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c
index 65604fc65e8f..44a4d2779b15 100644
--- a/drivers/crypto/ccp/ccp-dev-v5.c
+++ b/drivers/crypto/ccp/ccp-dev-v5.c
@@ -788,13 +788,12 @@ static int ccp5_init(struct ccp_device *ccp)
struct ccp_cmd_queue *cmd_q;
struct dma_pool *dma_pool;
char dma_pool_name[MAX_DMAPOOL_NAME_LEN];
-   unsigned int qmr, qim, i;
+   unsigned int qmr, i;
u64 status;
u32 status_lo, status_hi;
int ret;
 
/* Find available queues */
-   qim = 0;
qmr = ioread32(ccp->io_regs + Q_MASK_REG);
for (i = 0; i < MAX_HW_QUEUES; i++) {
 
-- 
2.14.1



[PATCH] crypto: cavium: clean up clang warning on unread variable offset

2017-10-12 Thread Colin King
From: Colin Ian King 

The variable offset is being assigned and not being used; it should
be passed as the 2nd argument to call to function nitrox_write_csr
but has been omitted. Fix this.

Cleans up clang warning: Value stored to 'offset' is never read

Fixes: 14fa93cdcd9b ("crypto: cavium - Add support for CNN55XX adapters.")
Signed-off-by: Colin Ian King 
---
 drivers/crypto/cavium/nitrox/nitrox_hal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/cavium/nitrox/nitrox_hal.c 
b/drivers/crypto/cavium/nitrox/nitrox_hal.c
index f0655f82fa7d..73275ce6a668 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_hal.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_hal.c
@@ -126,7 +126,7 @@ void nitrox_config_pkt_input_rings(struct nitrox_device 
*ndev)
 * size and interrupt threshold.
 */
offset = NPS_PKT_IN_INSTR_BADDRX(i);
-   nitrox_write_csr(ndev, NPS_PKT_IN_INSTR_BADDRX(i), cmdq->dma);
+   nitrox_write_csr(ndev, offset, cmdq->dma);
 
/* configure ring size */
offset = NPS_PKT_IN_INSTR_RSIZEX(i);
-- 
2.14.1



[PATCH] staging: ccree: remove unused and redundant variable idx

2017-09-16 Thread Colin King
From: Colin Ian King 

Variable idx is being set but never read and thus it can be
removed because it is redundant. Cleans up clang build warnings:

warning: Value stored to 'idx' during its initialization is never read
warning: Value stored to 'idx' is never read
warning: Value stored to 'idx' is never read

Signed-off-by: Colin Ian King 
---
 drivers/staging/ccree/ssi_aead.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 5abe6b24ff8c..8d6b95efce86 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -1812,7 +1812,6 @@ static inline int ssi_aead_gcm(
unsigned int *seq_size)
 {
struct aead_req_ctx *req_ctx = aead_request_ctx(req);
-   unsigned int idx = *seq_size;
unsigned int cipher_flow_mode;
 
if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
@@ -1829,7 +1828,6 @@ static inline int ssi_aead_gcm(
ssi_aead_create_assoc_desc(req, DIN_HASH, desc, seq_size);
ssi_aead_gcm_setup_gctr_desc(req, desc, seq_size);
ssi_aead_process_gcm_result_desc(req, desc, seq_size);
-   idx = *seq_size;
return 0;
}
 
@@ -1844,7 +1842,6 @@ static inline int ssi_aead_gcm(
ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, 
seq_size);
ssi_aead_process_gcm_result_desc(req, desc, seq_size);
 
-   idx = *seq_size;
return 0;
 }
 
-- 
2.14.1



[PATCH] crypto: algboss: remove redundant setting of len to zero

2017-09-14 Thread Colin King
From: Colin Ian King 

The variable len is set to zero, never read and then later updated
to p - name, so clearly the zero'ing of len is redundant and
can be removed.

Detected by clang scan-build:
" warning: Value stored to 'len' is never read"

Signed-off-by: Colin Ian King 
---
 crypto/algboss.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/crypto/algboss.c b/crypto/algboss.c
index 960d8548171b..5e6df2a087fa 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -122,7 +122,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval 
*larval)
int notnum = 0;
 
name = ++p;
-   len = 0;
 
for (; isalnum(*p) || *p == '-' || *p == '_'; p++)
notnum |= !isdigit(*p);
-- 
2.14.1



[PATCH] crypto: aesni: make arrays aesni_simd_skciphers and aesni_simd_skciphers2 static

2017-08-20 Thread Colin King
From: Colin Ian King 

Arrays aesni_simd_skciphers and aesni_simd_skciphers2 are local to the
source and do not need to be in global scope, so make them static.

Cleans up sparse warnings:
symbol 'aesni_simd_skciphers' was not declared. Should it be static?
symbol 'aesni_simd_skciphers2' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 arch/x86/crypto/aesni-intel_glue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/crypto/aesni-intel_glue.c 
b/arch/x86/crypto/aesni-intel_glue.c
index 5c15d6b57329..c4c20286f27e 100644
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ b/arch/x86/crypto/aesni-intel_glue.c
@@ -1067,9 +1067,10 @@ static struct skcipher_alg aesni_skciphers[] = {
}
 };
 
+static
 struct simd_skcipher_alg *aesni_simd_skciphers[ARRAY_SIZE(aesni_skciphers)];
 
-struct {
+static struct {
const char *algname;
const char *drvname;
const char *basename;
-- 
2.11.0



[PATCH] Crypto: atmel-ecc: Make a couple of local functions static

2017-07-19 Thread Colin King
From: Colin Ian King 

Functions atmel_ecc_i2c_client_alloc and atmel_ecc_i2c_client_free are
local to the source and no not need to be in the global scope. Make
them static.

Cleans up sparse warnings:
symbol 'atmel_ecc_i2c_client_alloc' was not declared. Should it be static?
symbol 'atmel_ecc_i2c_client_free' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/crypto/atmel-ecc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c
index 66ab1021eba5..c6e8de2b28dd 100644
--- a/drivers/crypto/atmel-ecc.c
+++ b/drivers/crypto/atmel-ecc.c
@@ -492,7 +492,7 @@ static int atmel_ecdh_compute_shared_secret(struct 
kpp_request *req)
return ret;
 }
 
-struct i2c_client *atmel_ecc_i2c_client_alloc(void)
+static struct i2c_client *atmel_ecc_i2c_client_alloc(void)
 {
struct atmel_ecc_i2c_client_priv *i2c_priv, *min_i2c_priv = NULL;
struct i2c_client *client = ERR_PTR(-ENODEV);
@@ -527,7 +527,7 @@ struct i2c_client *atmel_ecc_i2c_client_alloc(void)
return client;
 }
 
-void atmel_ecc_i2c_client_free(struct i2c_client *client)
+static void atmel_ecc_i2c_client_free(struct i2c_client *client)
 {
struct atmel_ecc_i2c_client_priv *i2c_priv = i2c_get_clientdata(client);
 
-- 
2.11.0



[PATCH] crypto: qat: fix spelling mistake: "runing" -> "running"

2017-06-26 Thread Colin King
From: Colin Ian King 

trivial fix to spelling mistake in dev_info message

Signed-off-by: Colin Ian King 
---
 drivers/crypto/qat/qat_common/adf_aer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_common/adf_aer.c 
b/drivers/crypto/qat/qat_common/adf_aer.c
index d3e25c37dc33..da8a2d3b5e9a 100644
--- a/drivers/crypto/qat/qat_common/adf_aer.c
+++ b/drivers/crypto/qat/qat_common/adf_aer.c
@@ -208,7 +208,7 @@ static pci_ers_result_t adf_slot_reset(struct pci_dev *pdev)
 static void adf_resume(struct pci_dev *pdev)
 {
dev_info(>dev, "Acceleration driver reset completed\n");
-   dev_info(>dev, "Device is up and runnig\n");
+   dev_info(>dev, "Device is up and running\n");
 }
 
 static const struct pci_error_handlers adf_err_handler = {
-- 
2.11.0



[PATCH] crypto: cavium: make several functions static

2017-06-20 Thread Colin King
From: Colin Ian King 

The functions cvm_encrypt, cvm_decrypt, cvm_xts_setkey and
cvm_enc_dec_init does not need to be in global scope, so make
them static.

Signed-off-by: Colin Ian King 
---
 drivers/crypto/cavium/cpt/cptvf_algs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/cavium/cpt/cptvf_algs.c 
b/drivers/crypto/cavium/cpt/cptvf_algs.c
index 1b220f3ed017..df21d996db7e 100644
--- a/drivers/crypto/cavium/cpt/cptvf_algs.c
+++ b/drivers/crypto/cavium/cpt/cptvf_algs.c
@@ -222,17 +222,17 @@ static inline int cvm_enc_dec(struct ablkcipher_request 
*req, u32 enc)
return -EINPROGRESS;
 }
 
-int cvm_encrypt(struct ablkcipher_request *req)
+static int cvm_encrypt(struct ablkcipher_request *req)
 {
return cvm_enc_dec(req, true);
 }
 
-int cvm_decrypt(struct ablkcipher_request *req)
+static int cvm_decrypt(struct ablkcipher_request *req)
 {
return cvm_enc_dec(req, false);
 }
 
-int cvm_xts_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
+static int cvm_xts_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
   u32 keylen)
 {
struct crypto_tfm *tfm = crypto_ablkcipher_tfm(cipher);
@@ -336,7 +336,7 @@ static int cvm_ecb_des3_setkey(struct crypto_ablkcipher 
*cipher, const u8 *key,
return cvm_setkey(cipher, key, keylen, DES3_ECB);
 }
 
-int cvm_enc_dec_init(struct crypto_tfm *tfm)
+static int cvm_enc_dec_init(struct crypto_tfm *tfm)
 {
struct cvm_enc_ctx *ctx = crypto_tfm_ctx(tfm);
 
-- 
2.11.0



[PATCH][crypto-next] crypto: cavium: fix spelling mistake "Revsion" -> "Revision"

2017-06-13 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in seq_printf message

Signed-off-by: Colin Ian King 
---
 drivers/crypto/cavium/nitrox/nitrox_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c 
b/drivers/crypto/cavium/nitrox/nitrox_main.c
index eee6fb501580..ae44a464cd2d 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_main.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_main.c
@@ -399,7 +399,7 @@ static int nitrox_show(struct seq_file *s, void *v)
struct nitrox_device *ndev = s->private;
 
seq_printf(s, "NITROX-5 [idx: %d]\n", ndev->idx);
-   seq_printf(s, "  Revsion ID: 0x%0x\n", ndev->hw.revision_id);
+   seq_printf(s, "  Revision ID: 0x%0x\n", ndev->hw.revision_id);
seq_printf(s, "  Cores [AE: %u  SE: %u]\n",
   ndev->hw.ae_cores, ndev->hw.se_cores);
seq_printf(s, "  Number of Queues: %u\n", ndev->nr_queues);
-- 
2.11.0



[PATCH][crypto-next] crypto: omap-aes: fix spelling mistake "Encryptio" -> "Encryption"

2017-06-13 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in pr_err message

Signed-off-by: Colin Ian King 
---
 drivers/crypto/omap-aes-gcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/omap-aes-gcm.c b/drivers/crypto/omap-aes-gcm.c
index 521a310ea699..7d4f8a4be6d8 100644
--- a/drivers/crypto/omap-aes-gcm.c
+++ b/drivers/crypto/omap-aes-gcm.c
@@ -214,7 +214,7 @@ static int do_encrypt_iv(struct aead_request *req, u32 
*tag, u32 *iv)
}
/* fall through */
default:
-   pr_err("Encryptio of IV failed for GCM mode");
+   pr_err("Encryption of IV failed for GCM mode");
break;
}
 
-- 
2.11.0



[PATCH] crypto: brcm: fix spelling mistake: "fallbck" -> "fallback"

2017-06-04 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in flow_log message

Signed-off-by: Colin Ian King 
---
 drivers/crypto/bcm/cipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 61393dc70b0b..9cfd36c1bcb6 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -2639,7 +2639,7 @@ static int aead_need_fallback(struct aead_request *req)
(spu->spu_type == SPU_TYPE_SPUM) &&
(ctx->digestsize != 8) && (ctx->digestsize != 12) &&
(ctx->digestsize != 16)) {
-   flow_log("%s() AES CCM needs fallbck for digest size %d\n",
+   flow_log("%s() AES CCM needs fallback for digest size %d\n",
 __func__, ctx->digestsize);
return 1;
}
-- 
2.11.0



[PATCH][V2] staging: ccree: fix spelling mistake: "chanined" -> "chained"

2017-06-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in SSI_LOG_ERR message

Signed-off-by: Colin Ian King 
---
 drivers/staging/ccree/ssi_buffer_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 04515e70d2d3..379eecf85ba1 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -156,7 +156,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents(
unsigned int nents = 0;
while (nbytes != 0) {
if (sg_is_chain(sg_list)) {
-   SSI_LOG_ERR("Unexpected chanined entry "
+   SSI_LOG_ERR("Unexpected chained entry "
   "in sg (entry =0x%X) \n", nents);
BUG();
}
-- 
2.11.0



[PATCH] taging: ccree: fix spelling mistake: "chanined" -> "chained"

2017-06-03 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake in SSI_LOG_ERR message

Signed-off-by: Colin Ian King 
---
 drivers/staging/ccree/ssi_buffer_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 04515e70d2d3..379eecf85ba1 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -156,7 +156,7 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents(
unsigned int nents = 0;
while (nbytes != 0) {
if (sg_is_chain(sg_list)) {
-   SSI_LOG_ERR("Unexpected chanined entry "
+   SSI_LOG_ERR("Unexpected chained entry "
   "in sg (entry =0x%X) \n", nents);
BUG();
}
-- 
2.11.0



[PATCH] crypto: glue_helper: remove redundant check on nbytes < bsize

2017-05-10 Thread Colin King
From: Colin Ian King 

There is a check to see if nbytes < bsize (and a jump to label 'done' if
it is true) inside the proceeding do-while loop so it is impossible for
the second nbytes < bsize check to be true, hence is it redundant and
can be removed. Remove it.

Detected by CoverityScan, CID#712347 ("Logically dead code")

Signed-off-by: Colin Ian King 
---
 arch/x86/crypto/glue_helper.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/crypto/glue_helper.c b/arch/x86/crypto/glue_helper.c
index 24ac9fad832d..d61e57960fe0 100644
--- a/arch/x86/crypto/glue_helper.c
+++ b/arch/x86/crypto/glue_helper.c
@@ -176,9 +176,6 @@ __glue_cbc_decrypt_128bit(const struct common_glue_ctx 
*gctx,
src -= 1;
dst -= 1;
} while (nbytes >= func_bytes);
-
-   if (nbytes < bsize)
-   goto done;
}
}
 
-- 
2.11.0



[PATCH] crypto: crypto4xx: rename ce_ring_contol to ce_ring_control

2017-04-21 Thread Colin King
From: Colin Ian King 

trivial spelling mistake, missing r, rename to ce_ring_control

Signed-off-by: Colin Ian King 
---
 drivers/crypto/amcc/crypto4xx_core.c| 2 +-
 drivers/crypto/amcc/crypto4xx_reg_def.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/amcc/crypto4xx_core.c 
b/drivers/crypto/amcc/crypto4xx_core.c
index d10b4ae5e0da..fdc83a2281ca 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -50,7 +50,7 @@
 static void crypto4xx_hw_init(struct crypto4xx_device *dev)
 {
union ce_ring_size ring_size;
-   union ce_ring_contol ring_ctrl;
+   union ce_ring_control ring_ctrl;
union ce_part_ring_size part_ring_size;
union ce_io_threshold io_threshold;
u32 rand_num;
diff --git a/drivers/crypto/amcc/crypto4xx_reg_def.h 
b/drivers/crypto/amcc/crypto4xx_reg_def.h
index 46fe57c8f6eb..279b8725559f 100644
--- a/drivers/crypto/amcc/crypto4xx_reg_def.h
+++ b/drivers/crypto/amcc/crypto4xx_reg_def.h
@@ -180,7 +180,7 @@ union ce_ring_size {
 } __attribute__((packed));
 
 #define CRYPTO4XX_RING_CONTROL_OFFSET  0x54
-union ce_ring_contol {
+union ce_ring_control {
struct {
u32 continuous:1;
u32 rsv:5;
-- 
2.11.0



[PATCH] crypto: brcm: fix spelling mistake: "genereate" -> "generate"

2017-02-22 Thread Colin King
From: Colin Ian King 

trivial fix to spelling mistake in pr_err message

Signed-off-by: Colin Ian King 
---
 drivers/crypto/bcm/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/bcm/util.c b/drivers/crypto/bcm/util.c
index 0502f46..430c557 100644
--- a/drivers/crypto/bcm/util.c
+++ b/drivers/crypto/bcm/util.c
@@ -312,7 +312,7 @@ int do_shash(unsigned char *name, unsigned char *result,
}
rc = crypto_shash_final(>shash, result);
if (rc)
-   pr_err("%s: Could not genereate %s hash", __func__, name);
+   pr_err("%s: Could not generate %s hash", __func__, name);
 
 do_shash_err:
crypto_free_shash(hash);
-- 
2.10.2



[PATCH] crypto: cavium: fix leak on curr if curr->head fails to be allocated

2017-02-17 Thread Colin King
From: Colin Ian King 

The exit path when curr->head cannot be allocated fails to kfree the
earlier allocated curr.  Fix this by kfree'ing it.

Signed-off-by: Colin Ian King 
---
 drivers/crypto/cavium/cpt/cptvf_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/cavium/cpt/cptvf_main.c 
b/drivers/crypto/cavium/cpt/cptvf_main.c
index 527bdc3..3247c7f 100644
--- a/drivers/crypto/cavium/cpt/cptvf_main.c
+++ b/drivers/crypto/cavium/cpt/cptvf_main.c
@@ -242,6 +242,7 @@ static int alloc_command_queues(struct cpt_vf *cptvf,
if (!curr->head) {
dev_err(>dev, "Command Q (%d) chunk (%d) 
allocation failed\n",
i, queue->nchunks);
+   kfree(curr);
goto cmd_qfail;
}
 
-- 
2.10.2



[PATCH] crypto: atmel-sha: use %zu for size_t print format specifier

2017-02-07 Thread Colin King
From: Colin Ian King 

The size_t types should be using %zu as a format specifier rather
than %d and %u.

Signed-off-by: Colin Ian King 
---
 drivers/crypto/atmel-sha.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 22d0c0c..b081e78 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -568,7 +568,7 @@ static int atmel_sha_xmit_cpu(struct atmel_sha_dev *dd, 
const u8 *buf,
int count, len32;
const u32 *buffer = (const u32 *)buf;
 
-   dev_dbg(dd->dev, "xmit_cpu: digcnt: 0x%llx 0x%llx, length: %d, final: 
%d\n",
+   dev_dbg(dd->dev, "xmit_cpu: digcnt: 0x%llx 0x%llx, length: %zu, final: 
%d\n",
ctx->digcnt[1], ctx->digcnt[0], length, final);
 
atmel_sha_write_ctrl(dd, 0);
@@ -597,7 +597,7 @@ static int atmel_sha_xmit_pdc(struct atmel_sha_dev *dd, 
dma_addr_t dma_addr1,
struct atmel_sha_reqctx *ctx = ahash_request_ctx(dd->req);
int len32;
 
-   dev_dbg(dd->dev, "xmit_pdc: digcnt: 0x%llx 0x%llx, length: %d, final: 
%d\n",
+   dev_dbg(dd->dev, "xmit_pdc: digcnt: 0x%llx 0x%llx, length: %zu, final: 
%d\n",
ctx->digcnt[1], ctx->digcnt[0], length1, final);
 
len32 = DIV_ROUND_UP(length1, sizeof(u32));
@@ -644,7 +644,7 @@ static int atmel_sha_xmit_dma(struct atmel_sha_dev *dd, 
dma_addr_t dma_addr1,
struct dma_async_tx_descriptor  *in_desc;
struct scatterlist sg[2];
 
-   dev_dbg(dd->dev, "xmit_dma: digcnt: 0x%llx 0x%llx, length: %d, final: 
%d\n",
+   dev_dbg(dd->dev, "xmit_dma: digcnt: 0x%llx 0x%llx, length: %zu, final: 
%d\n",
ctx->digcnt[1], ctx->digcnt[0], length1, final);
 
dd->dma_lch_in.dma_conf.src_maxburst = 16;
@@ -723,7 +723,7 @@ static int atmel_sha_xmit_dma_map(struct atmel_sha_dev *dd,
ctx->dma_addr = dma_map_single(dd->dev, ctx->buffer,
ctx->buflen + ctx->block_size, DMA_TO_DEVICE);
if (dma_mapping_error(dd->dev, ctx->dma_addr)) {
-   dev_err(dd->dev, "dma %u bytes error\n", ctx->buflen +
+   dev_err(dd->dev, "dma %zu bytes error\n", ctx->buflen +
ctx->block_size);
atmel_sha_complete(dd, -EINVAL);
}
@@ -744,7 +744,7 @@ static int atmel_sha_update_dma_slow(struct atmel_sha_dev 
*dd)
 
final = (ctx->flags & SHA_FLAGS_FINUP) && !ctx->total;
 
-   dev_dbg(dd->dev, "slow: bufcnt: %u, digcnt: 0x%llx 0x%llx, final: %d\n",
+   dev_dbg(dd->dev, "slow: bufcnt: %zu, digcnt: 0x%llx 0x%llx, final: 
%d\n",
 ctx->bufcnt, ctx->digcnt[1], ctx->digcnt[0], final);
 
if (final)
@@ -772,7 +772,7 @@ static int atmel_sha_update_dma_start(struct atmel_sha_dev 
*dd)
if (ctx->bufcnt || ctx->offset)
return atmel_sha_update_dma_slow(dd);
 
-   dev_dbg(dd->dev, "fast: digcnt: 0x%llx 0x%llx, bufcnt: %u, total: %u\n",
+   dev_dbg(dd->dev, "fast: digcnt: 0x%llx 0x%llx, bufcnt: %zu, total: 
%u\n",
ctx->digcnt[1], ctx->digcnt[0], ctx->bufcnt, ctx->total);
 
sg = ctx->sg;
@@ -814,7 +814,7 @@ static int atmel_sha_update_dma_start(struct atmel_sha_dev 
*dd)
ctx->dma_addr = dma_map_single(dd->dev, ctx->buffer,
ctx->buflen + ctx->block_size, DMA_TO_DEVICE);
if (dma_mapping_error(dd->dev, ctx->dma_addr)) {
-   dev_err(dd->dev, "dma %u bytes error\n",
+   dev_err(dd->dev, "dma %zu bytes error\n",
ctx->buflen + ctx->block_size);
atmel_sha_complete(dd, -EINVAL);
}
@@ -994,7 +994,7 @@ static int atmel_sha_finish(struct ahash_request *req)
if (ctx->digcnt[0] || ctx->digcnt[1])
atmel_sha_copy_ready_hash(req);
 
-   dev_dbg(dd->dev, "digcnt: 0x%llx 0x%llx, bufcnt: %d\n", ctx->digcnt[1],
+   dev_dbg(dd->dev, "digcnt: 0x%llx 0x%llx, bufcnt: %zu\n", ctx->digcnt[1],
ctx->digcnt[0], ctx->bufcnt);
 
return 0;
-- 
2.10.2



[PATCH] crypto: mediatek: don't return garbage err on successful return

2017-01-03 Thread Colin King
From: Colin Ian King 

In the case where keylen <= bs mtk_sha_setkey returns an uninitialized
return value in err.  Fix this by returning 0 instead of err.

Issue detected by static analysis with cppcheck.

Signed-off-by: Colin Ian King 
---
 drivers/crypto/mediatek/mtk-sha.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/mediatek/mtk-sha.c 
b/drivers/crypto/mediatek/mtk-sha.c
index 8951363..8e1b440 100644
--- a/drivers/crypto/mediatek/mtk-sha.c
+++ b/drivers/crypto/mediatek/mtk-sha.c
@@ -878,7 +878,7 @@ static int mtk_sha_setkey(struct crypto_ahash *tfm,
bctx->opad[i] ^= 0x5c;
}
 
-   return err;
+   return 0;
 }
 
 static int mtk_sha_export(struct ahash_request *req, void *out)
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: talitos: fix spelling mistake

2016-11-01 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake "pointeur" to "pointer"
in dev_err message

Signed-off-by: Colin Ian King 
---
 drivers/crypto/talitos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 0418a2f..0bba6a1 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -590,7 +590,7 @@ static void talitos_error(struct device *dev, u32 isr, u32 
isr_lo)
if (v_lo & TALITOS_CCPSR_LO_MDTE)
dev_err(dev, "master data transfer error\n");
if (v_lo & TALITOS_CCPSR_LO_SGDLZ)
-   dev_err(dev, is_sec1 ? "pointeur not complete error\n"
+   dev_err(dev, is_sec1 ? "pointer not complete error\n"
 : "s/g data length zero error\n");
if (v_lo & TALITOS_CCPSR_LO_FPZ)
dev_err(dev, is_sec1 ? "parity error\n"
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: sahara: fix typo "Decidated" -> "Dedicated"

2016-10-25 Thread Colin King
From: Colin Ian King 

Trivial fix to typo in dev_dbg message

Signed-off-by: Colin Ian King 
---
 drivers/crypto/sahara.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 0c49956..7ba0eae 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -390,7 +390,7 @@ static void sahara_decode_status(struct sahara_dev *dev, 
unsigned int status)
if (status & SAHARA_STATUS_MODE_BATCH)
dev_dbg(dev->device, "  - Batch Mode.\n");
else if (status & SAHARA_STATUS_MODE_DEDICATED)
-   dev_dbg(dev->device, "  - Decidated Mode.\n");
+   dev_dbg(dev->device, "  - Dedicated Mode.\n");
else if (status & SAHARA_STATUS_MODE_DEBUG)
dev_dbg(dev->device, "  - Debug Mode.\n");
 
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] s390/crypto: initialize ret to zero to avoid returning garbage value

2016-09-05 Thread Colin King
From: Colin Ian King 

static analysis with cppcheck detected that ret is not initialized
and hence garbage is potentially being returned in the case where
prng_data->ppnows.reseed_counter <= prng_reseed_limit.

Signed-off-by: Colin Ian King 
---
 arch/s390/crypto/prng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 79e3a1f..a21fdf4 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -412,7 +412,7 @@ static int prng_sha512_reseed(void)
 
 static int prng_sha512_generate(u8 *buf, size_t nbytes)
 {
-   int ret;
+   int ret = 0;
 
/* reseed needed ? */
if (prng_data->ppnows.reseed_counter > prng_reseed_limit) {
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] PKCS#7: fix missing break on OID_sha224 case

2016-03-19 Thread Colin King
From: Colin Ian King 

The OID_sha224 case is missing a break and it falls through
to the -ENOPKG error default.  Since HASH_ALGO_SHA224 seems
to be supported, this looks like an unintentional missing break.

Fixes: 07f081fb5057 ("PKCS#7: Add OIDs for sha224, sha284 and sha512 hash algos 
and use them")
Cc:  # 4.2+
Signed-off-by: Colin Ian King 
---
 crypto/asymmetric_keys/pkcs7_parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/crypto/asymmetric_keys/pkcs7_parser.c 
b/crypto/asymmetric_keys/pkcs7_parser.c
index 40de03f..bdd0d753 100644
--- a/crypto/asymmetric_keys/pkcs7_parser.c
+++ b/crypto/asymmetric_keys/pkcs7_parser.c
@@ -237,6 +237,7 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
break;
case OID_sha224:
ctx->sinfo->sig.hash_algo = "sha224";
+   break;
default:
printk("Unsupported digest algo: %u\n", ctx->last_oid);
return -ENOPKG;
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: fix spelling mistake in dev_err error message

2015-08-02 Thread Colin King
From: Colin Ian King colin.k...@canonical.com

Trival change, fix spelling mistake 'aquire' - 'acquire' in
dev_err message.

Signed-off-by: Colin Ian King colin.k...@canonical.com
---
 drivers/crypto/img-hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index ad47d0d..68e8aa9 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -334,7 +334,7 @@ static int img_hash_dma_init(struct img_hash_dev *hdev)
 
hdev-dma_lch = dma_request_slave_channel(hdev-dev, tx);
if (!hdev-dma_lch) {
-   dev_err(hdev-dev, Couldn't aquire a slave DMA channel.\n);
+   dev_err(hdev-dev, Couldn't acquire a slave DMA channel.\n);
return -EBUSY;
}
dma_conf.direction = DMA_MEM_TO_DEV;
-- 
2.5.0

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: ensure backlog is initialised

2015-04-14 Thread Colin King
From: Colin Ian King colin.k...@canonical.com

backlog is not initialised so in the case where
cpg-eng_st != ENGINE_IDLE it is never initialised and
hence which could lead to an illegal memory dereference
in the statement:

  backlog-complete(backlog, -EINPROGRESS);

Discovered with cppcheck static analsys:
[drivers/crypto/mv_cesa.c:616]:
   (error) Uninitialized variable: backlog

Signed-off-by: Colin Ian King colin.k...@canonical.com
---
 drivers/crypto/mv_cesa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index f91f15d..e63efbd 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -595,7 +595,7 @@ static int queue_manag(void *data)
cpg-eng_st = ENGINE_IDLE;
do {
struct crypto_async_request *async_req = NULL;
-   struct crypto_async_request *backlog;
+   struct crypto_async_request *backlog = NULL;
 
__set_current_state(TASK_INTERRUPTIBLE);
 
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: fix typo in dev_err error message

2015-02-28 Thread Colin King
From: Colin Ian King colin.k...@canonical.com

Fix typo, intialization - initialization

Signed-off-by: Colin Ian King colin.k...@canonical.com
---
 drivers/crypto/atmel-aes.c  | 2 +-
 drivers/crypto/atmel-sha.c  | 2 +-
 drivers/crypto/atmel-tdes.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 6597aac..2e875aa 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -1374,7 +1374,7 @@ static int atmel_aes_probe(struct platform_device *pdev)
/* Initializing the clock */
aes_dd-iclk = clk_get(pdev-dev, aes_clk);
if (IS_ERR(aes_dd-iclk)) {
-   dev_err(dev, clock intialization failed.\n);
+   dev_err(dev, clock initialization failed.\n);
err = PTR_ERR(aes_dd-iclk);
goto clk_err;
}
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 34db04a..325d6b6 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -1385,7 +1385,7 @@ static int atmel_sha_probe(struct platform_device *pdev)
/* Initializing the clock */
sha_dd-iclk = clk_get(pdev-dev, sha_clk);
if (IS_ERR(sha_dd-iclk)) {
-   dev_err(dev, clock intialization failed.\n);
+   dev_err(dev, clock initialization failed.\n);
err = PTR_ERR(sha_dd-iclk);
goto clk_err;
}
diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c
index 258772d..8495b8959 100644
--- a/drivers/crypto/atmel-tdes.c
+++ b/drivers/crypto/atmel-tdes.c
@@ -1408,7 +1408,7 @@ static int atmel_tdes_probe(struct platform_device *pdev)
/* Initializing the clock */
tdes_dd-iclk = clk_get(pdev-dev, tdes_clk);
if (IS_ERR(tdes_dd-iclk)) {
-   dev_err(dev, clock intialization failed.\n);
+   dev_err(dev, clock initialization failed.\n);
err = PTR_ERR(tdes_dd-iclk);
goto clk_err;
}
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] arm64/crypto: remove redundant update of data

2014-08-24 Thread Colin King
From: Colin Ian King colin.k...@canonical.com

Originally found by cppcheck:

[arch/arm64/crypto/sha2-ce-glue.c:153]: (warning) Assignment of
  function parameter has no effect outside the function. Did you
  forget dereferencing it?

Updating data by blocks * SHA256_BLOCK_SIZE at the end of
ha2_finup is redundant code and can be removed.

Signed-off-by: Colin Ian King colin.k...@canonical.com
---
 arch/arm64/crypto/sha2-ce-glue.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/crypto/sha2-ce-glue.c b/arch/arm64/crypto/sha2-ce-glue.c
index c294e67..ae67e88 100644
--- a/arch/arm64/crypto/sha2-ce-glue.c
+++ b/arch/arm64/crypto/sha2-ce-glue.c
@@ -150,7 +150,6 @@ static void sha2_finup(struct shash_desc *desc, const u8 
*data,
kernel_neon_begin_partial(28);
sha2_ce_transform(blocks, data, sctx-state, NULL, len);
kernel_neon_end();
-   data += blocks * SHA256_BLOCK_SIZE;
 }
 
 static int sha224_finup(struct shash_desc *desc, const u8 *data,
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-crypto in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html