[PATCH] crypto: fix simple_return.cocci warnings

2015-08-11 Thread kbuild test robot
drivers/crypto/qat/qat_common/adf_sriov.c:258:1-4: WARNING: end returns can be 
simpified and declaration on line 212 can be dropped

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

CC: Tadeusz Struk 
Signed-off-by: Fengguang Wu 
---

 adf_sriov.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

--- a/drivers/crypto/qat/qat_common/adf_sriov.c
+++ b/drivers/crypto/qat/qat_common/adf_sriov.c
@@ -209,7 +209,7 @@ static int adf_enable_sriov(struct adf_a
&GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)];
void __iomem *pmisc_addr = pmisc->virt_addr;
struct adf_accel_vf_info *vf_info;
-   int i, ret;
+   int i;
u32 reg;
 
/* Workqueue for PF2VF responses */
@@ -255,11 +255,7 @@ static int adf_enable_sriov(struct adf_a
 * order for all the hardware resources (i.e. bundles) to be usable.
 * When SR-IOV is enabled, each of the VFs will own one bundle.
 */
-   ret = pci_enable_sriov(pdev, totalvfs);
-   if (ret)
-   return ret;
-
-   return 0;
+   return pci_enable_sriov(pdev, totalvfs);
 }
 
 /**
--
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


[cryptodev:master 118/125] drivers/crypto/qat/qat_common/adf_sriov.c:258:1-4: WARNING: end returns can be simpified and declaration on line 212 can be dropped

2015-08-11 Thread kbuild test robot
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git 
master
head:   d5cf4023ebcbae13e14e3ab3c55cb744321b352e
commit: ed8ccaef52fa03fb03cff45b380f72c9f869f273 [118/125] crypto: qat - Add 
support for SRIOV


coccinelle warnings: (new ones prefixed by >>)

>> drivers/crypto/qat/qat_common/adf_sriov.c:258:1-4: WARNING: end returns can 
>> be simpified and declaration on line 212 can be dropped

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
--
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


Re: [cryptodev:master 119/123] warning: (CRYPTO_DEV_QAT_DH895xCCVF) selects PCI_IOV which has unmet direct dependencies (PCI)

2015-08-11 Thread Tadeusz Struk
On 08/11/2015 06:57 AM, Herbert Xu wrote:
> On Mon, Aug 10, 2015 at 10:44:09AM -0700, Tadeusz Struk wrote:
>> >
>> >  config CRYPTO_DEV_QAT_DH895xCCVF
>> >tristate "Support for Intel(R) DH895xCC Virtual Function"
>> > +  select PCI
>> >select PCI_IOV
> Wouldn't a dependency on PCI make more sense? Or does this not
> work?

Yes, you are right. This is how it is in the PF config.
It also needs to select the qat common code.

---8<---
Fix unmet direct dependencies for QAT_DH895xCCVF

Reported-by: Fengguang Wu 
Signed-off-by: Tadeusz Struk 

diff --git a/drivers/crypto/qat/Kconfig b/drivers/crypto/qat/Kconfig
index 95a9566..eefccf7 100644
--- a/drivers/crypto/qat/Kconfig
+++ b/drivers/crypto/qat/Kconfig
@@ -24,7 +24,9 @@ config CRYPTO_DEV_QAT_DH895xCC
 
 config CRYPTO_DEV_QAT_DH895xCCVF
tristate "Support for Intel(R) DH895xCC Virtual Function"
+   depends on X86 && PCI
select PCI_IOV
+   select CRYPTO_DEV_QAT
 
help
  Support for Intel(R) DH895xcc with Intel(R) QuickAssist Technology

--
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: caam - fix memory corruption in ahash_final_ctx

2015-08-11 Thread Horia Geantă
When doing pointer operation for accessing the HW S/G table,
a value representing number of entries (and not number of bytes)
must be used.

Cc:  # 3.6+
Fixes: 045e36780f115 ("crypto: caam - ahash hmac support")
Signed-off-by: Horia Geantă 
---
 drivers/crypto/caam/caamhash.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index bb0935a3817c..6c142617f8cc 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -909,13 +909,14 @@ static int ahash_final_ctx(struct ahash_request *req)
  state->buflen_1;
u32 *sh_desc = ctx->sh_desc_fin, *desc;
dma_addr_t ptr = ctx->sh_desc_fin_dma;
-   int sec4_sg_bytes;
+   int sec4_sg_bytes, sec4_sg_src_index;
int digestsize = crypto_ahash_digestsize(ahash);
struct ahash_edesc *edesc;
int ret = 0;
int sh_len;
 
-   sec4_sg_bytes = (1 + (buflen ? 1 : 0)) * sizeof(struct sec4_sg_entry);
+   sec4_sg_src_index = 1 + (buflen ? 1 : 0);
+   sec4_sg_bytes = sec4_sg_src_index * sizeof(struct sec4_sg_entry);
 
/* allocate space for base edesc and hw desc commands, link tables */
edesc = kzalloc(sizeof(*edesc) + DESC_JOB_IO_LEN + sec4_sg_bytes,
@@ -942,7 +943,7 @@ static int ahash_final_ctx(struct ahash_request *req)
state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1,
buf, state->buf_dma, buflen,
last_buflen);
-   (edesc->sec4_sg + sec4_sg_bytes - 1)->len |= SEC4_SG_LEN_FIN;
+   (edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN;
 
edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
sec4_sg_bytes, DMA_TO_DEVICE);
-- 
2.4.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


Re: [cryptodev:master 119/123] (.text+0x7a3): multiple definition of `adf_isr_resource_free'

2015-08-11 Thread Herbert Xu
On Mon, Aug 10, 2015 at 01:00:02PM -0700, Tadeusz Struk wrote:
> On 08/10/2015 12:36 PM, kbuild test robot wrote:
> > tree:   
> > git://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git 
> > master
> > head:   9cfaf082b8775e9f99fa5f2e8b2ae0ca8baff785
> > commit: dd0f368398ea100e34259bf812bc482e15c81991 [119/123] crypto: qat - 
> > Add qat dh895xcc VF driver
> > config: i386-allyesconfig (attached as .config)
> > reproduce:
> >   git checkout dd0f368398ea100e34259bf812bc482e15c81991
> >   # save the attached .config to linux build tree
> >   make ARCH=i386 
> > 
> > All error/warnings (new ones prefixed by >>):
> > 
> >drivers/crypto/qat/qat_dh895xccvf/built-in.o: In function 
> > `adf_isr_resource_free':
> >>> >> (.text+0x7a3): multiple definition of `adf_isr_resource_free'
> >drivers/crypto/qat/qat_dh895xcc/built-in.o:(.text+0x5f9): first defined 
> > here
> >drivers/crypto/qat/qat_dh895xccvf/built-in.o: In function 
> > `adf_isr_resource_alloc':
> >>> >> (.text+0x818): multiple definition of `adf_isr_resource_alloc'
> >drivers/crypto/qat/qat_dh895xcc/built-in.o:(.text+0x6d7): first defined 
> > here
> 
> ---8<---
> 
> When both PF and VF drivers are build in linker complains about multiple
> definition of adf_isr_resource_[alloc/free] functions.
> 
> Reported-by: Fengguang Wu 
> Signed-off-by: Tadeusz Struk 

Applied.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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


Re: [PATCH] Fix email address mistypo for NX/VMX crypto driver maintainers

2015-08-11 Thread Herbert Xu
On Mon, Aug 10, 2015 at 04:14:17PM -0300, Paulo Flabiano Smorigo wrote:
> ---
>  MAINTAINERS | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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


Re: [PATCH] crypto: nx-sha256/512: respect sg limit bounds when building sg lists

2015-08-11 Thread Herbert Xu
On Sat, Aug 08, 2015 at 08:47:28AM +0200, Jan Stancek wrote:
> Commit 000851119e80 changed sha256/512 update functions to
> pass more data to nx_build_sg_list(), which ends with
> sg list overflows and usually with update functions failing
> for data larger than max_sg_len * NX_PAGE_SIZE.
> 
> This happens because:
> - both "total" and "to_process" are updated, which leads to
>   "to_process" getting overflowed for some data lengths
>   For example:
> In first iteration "total" is 50, and let's assume "to_process"
> is 30 due to sg limits. At the end of first iteration "total" is
> set to 20. At start of 2nd iteration "to_process" overflows on:
>   to_process = total - to_process;
> - "in_sg" is not reset to nx_ctx->in_sg after each iteration
> - nx_build_sg_list() is hitting overflow because the amount of data
>   passed to it would require more than sgmax elements
> - as consequence of previous item, data stored in overflowed sg list
>   may no longer be aligned to SHA*_BLOCK_SIZE
> 
> This patch changes sha256/512 update functions so that "to_process"
> respects sg limits and never tries to pass more data to
> nx_build_sg_list() to avoid overflows. "to_process" is calculated
> as minimum of "total" and sg limits at start of every iteration.
> 
> Fixes: 000851119e80 ("crypto: nx - Fix SHA concurrence issue and sg
>   limit bounds")
> 
> Signed-off-by: Jan Stancek 
> Cc: Leonidas Da Silva Barbosa 
> Cc: Marcelo Henrique Cerri 
> Cc: Fionnuala Gunter 
> Cc: Herbert Xu 
> Cc: "David S. Miller" 

Patch applied with stable cc.  Thanks a lot!
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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


Re: [cryptodev:master 119/123] warning: (CRYPTO_DEV_QAT_DH895xCCVF) selects PCI_IOV which has unmet direct dependencies (PCI)

2015-08-11 Thread Herbert Xu
On Mon, Aug 10, 2015 at 10:44:09AM -0700, Tadeusz Struk wrote:
>
>  config CRYPTO_DEV_QAT_DH895xCCVF
>   tristate "Support for Intel(R) DH895xCC Virtual Function"
> + select PCI
>   select PCI_IOV

Wouldn't a dependency on PCI make more sense? Or does this not
work?

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
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