From: Vinod Koul <vinod.koul@intel.com>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Lars-Peter Clausen <lars@metafoo.de>
Cc: Dan Williams <dan.j.williams@intel.com>,
Michal Simek <michal.simek@xilinx.com>,
Dan Carpenter <dan.carpenter@oracle.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
Kyungmin Park <kyungmin.park@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [RESEND PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters
Date: Tue, 14 Oct 2014 17:21:18 +0530 [thread overview]
Message-ID: <20141014115118.GG1638@intel.com> (raw)
In-Reply-To: <1411994541-31494-1-git-send-email-k.kozlowski@samsung.com>
On Mon, Sep 29, 2014 at 02:42:18PM +0200, Krzysztof Kozlowski wrote:
> The pl330_submit_req() checked supplied 'struct pl330_thread thrd' and
> 'struct dma_pl330_desc desc' parameters for non-NULL. However these
> checks are useless because supplied arguments won't be NULL.
even if we have some error or bug?
I would like this to be checked and complained loudly so we know something
is going wrong rather than assuming it will be correct always.
--
~Vinod
>
> The pl330_submit_req() is called in only one place and:
> 1. 'desc' is already dereferenced in fill_queue() before calling
> pl330_submit_req().
> 2. 'thrd' is always dereferenced after calling
> fill_queue()->pl330_submit_req().
>
> Removing the checks for non-NULL values fixes following warning:
> drivers/dma/pl330.c:1376 pl330_submit_req() warn: variable dereferenced before check 'thrd' (see line 1367)
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>
> ---
>
> Changes since v1:
> =================
> 1. Remove the checks for non-NULL completely instead of moving them
> before dereference. Suggested by Lars-Peter Clausen.
> ---
> drivers/dma/pl330.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index d5149aacd2fe..57049f84d0c0 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -1372,10 +1372,6 @@ static int pl330_submit_req(struct pl330_thread *thrd,
> u32 ccr;
> int ret = 0;
>
> - /* No Req or Unacquired Channel or DMAC */
> - if (!desc || !thrd || thrd->free)
> - return -EINVAL;
> -
> regs = thrd->dmac->base;
>
> if (pl330->state == DYING
> --
> 1.9.1
>
--
next prev parent reply other threads:[~2014-10-14 12:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-29 12:42 [RESEND PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters Krzysztof Kozlowski
2014-09-29 12:42 ` [RESEND PATCH v2 2/4] dmaengine: pl330: Remove unused 'regs' variable in pl330_submit_req() Krzysztof Kozlowski
2014-10-14 12:02 ` Vinod Koul
2014-09-29 12:42 ` [RESEND PATCH v2 3/4] dmaengine: pl330: Fix NULL pointer dereference on probe failure Krzysztof Kozlowski
2014-10-14 12:03 ` Vinod Koul
2014-09-29 12:42 ` [RESEND PATCH v2 4/4] dmaengine: pl330: Fix NULL pointer dereference on driver unbind Krzysztof Kozlowski
2014-10-14 12:03 ` Vinod Koul
2014-10-14 11:51 ` Vinod Koul [this message]
2014-10-14 12:40 ` [RESEND PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters Lars-Peter Clausen
2014-10-15 7:57 ` Vinod Koul
2014-10-14 12:44 ` Krzysztof Kozlowski
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=20141014115118.GG1638@intel.com \
--to=vinod.koul@intel.com \
--cc=b.zolnierkie@samsung.com \
--cc=dan.carpenter@oracle.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=k.kozlowski@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=michal.simek@xilinx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).