From: "Horia Geantă" <horia.geanta@freescale.com>
To: <yanjiang.jin@windriver.com>, <herbert@gondor.apana.org.au>,
<davem@davemloft.net>
Cc: <kim.phillips@freescale.com>, <ruchika.gupta@freescale.com>,
<cristian.stoica@freescale.com>, <NiteshNarayanLal@freescale.com>,
<jinyanjiang@gmail.com>, <linux-kernel@vger.kernel.org>,
<linux-crypto@vger.kernel.org>
Subject: Re: [PATCH 3/4] crypto: caamhash: add two missed dma_mapping_error
Date: Mon, 2 Mar 2015 13:53:48 +0200 [thread overview]
Message-ID: <54F44F4C.8050604@freescale.com> (raw)
In-Reply-To: <1425103234-31129-3-git-send-email-yanjiang.jin@windriver.com>
On 2/28/2015 8:00 AM, yanjiang.jin@windriver.com wrote:
> From: Yanjiang Jin <yanjiang.jin@windriver.com>
>
> Add two missed dma_mapping_error() after dma_map_single().
>
> Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
> ---
> drivers/crypto/caam/caamhash.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
> index f347ab7..f6ad322 100644
> --- a/drivers/crypto/caam/caamhash.c
> +++ b/drivers/crypto/caam/caamhash.c
> @@ -160,6 +160,10 @@ static inline dma_addr_t map_seq_out_ptr_result(u32 *desc, struct device *jrdev,
> dma_addr_t dst_dma;
>
> dst_dma = dma_map_single(jrdev, result, digestsize, DMA_FROM_DEVICE);
> + if (dma_mapping_error(jrdev, dst_dma)) {
> + dev_err(jrdev, "unable to map dst dma\n");
> + return -ENOMEM;
> + }
> append_seq_out_ptr(desc, dst_dma, digestsize, 0);
>
> return dst_dma;
Value returned by map_seq_out_ptr_result() - dst_dma - is always fed to
dma_mapping_error().
Note that using an invalid dst_dma in append_seq_out_ptr() doesn't break
anything, so it's ok to check dst_dma later.
> @@ -173,6 +177,10 @@ static inline dma_addr_t buf_map_to_sec4_sg(struct device *jrdev,
> dma_addr_t buf_dma;
>
> buf_dma = dma_map_single(jrdev, buf, buflen, DMA_TO_DEVICE);
> + if (dma_mapping_error(jrdev, buf_dma)) {
> + dev_err(jrdev, "unable to map buf dma\n");
> + return 0;
> + }
> dma_to_sec4_sg_one(sec4_sg, buf_dma, buflen, 0);
>
> return buf_dma;
>
These functions are expected to return dma_addr_t, not an error code.
If dma_mapping_error() is needed within their scope, the return type
will have to change. And return value will need to be checked by their
callers.
next prev parent reply other threads:[~2015-03-02 11:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-28 6:00 [PATCH 1/4] crypto: caam: fix some compile warnings yanjiang.jin
2015-02-28 6:00 ` [PATCH 2/4] crypto: caam_rng: fix rng_unmap_ctx's DMA_UNMAP size problem yanjiang.jin
2015-03-02 11:09 ` Horia Geantă
2015-02-28 6:00 ` [PATCH 3/4] crypto: caamhash: add two missed dma_mapping_error yanjiang.jin
2015-03-02 11:53 ` Horia Geantă [this message]
2015-03-03 6:57 ` yjin
2015-02-28 6:00 ` [PATCH 4/4] crypto: caamhash: replace kmalloc with kzalloc yanjiang.jin
2015-03-02 11:03 ` Horia Geantă
2015-03-03 6:54 ` yjin
2015-03-02 11:08 ` [PATCH 1/4] crypto: caam: fix some compile warnings Horia Geantă
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54F44F4C.8050604@freescale.com \
--to=horia.geanta@freescale.com \
--cc=NiteshNarayanLal@freescale.com \
--cc=cristian.stoica@freescale.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=jinyanjiang@gmail.com \
--cc=kim.phillips@freescale.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ruchika.gupta@freescale.com \
--cc=yanjiang.jin@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.