From: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
To: Kukjin Kim <kgene@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Andi Shyti <andi.shyti@samsung.com>,
Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Subject: [PATCH] spi: add null check before pointer dereference
Date: Mon, 22 May 2017 19:25:07 -0500 [thread overview]
Message-ID: <20170523002507.GA16670@embeddedgus> (raw)
Add null check before dereferencing pointer desc
Addresses-Coverity-ID: 1397997
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
drivers/spi/spi-s3c64xx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index b392cca..9f1013e 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -306,6 +306,12 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents,
dma->direction, DMA_PREP_INTERRUPT);
+ if (!desc) {
+ dev_err(&sdd->master->dev,
+ "%s:dmaengine_prep_slave_sg Failed\n", __func__);
+ return;
+ }
+
desc->callback = s3c64xx_spi_dmacb;
desc->callback_param = dma;
--
2.5.0
next reply other threads:[~2017-05-23 0:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170523002511epcas4p3b7737552432363b089e4a9018e43f6f5@epcas4p3.samsung.com>
2017-05-23 0:25 ` Gustavo A. R. Silva [this message]
2017-05-23 7:24 ` [PATCH] spi: add null check before pointer dereference Krzysztof Kozlowski
[not found] ` <CAJKOXPepyk6KtSUNXymjMkT6qTX9PnCC1LvTC4y_2dL0nZ-kMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-23 7:33 ` Geert Uytterhoeven
2017-05-29 3:59 ` Andi Shyti
2017-05-30 2:33 ` Gustavo A. R. Silva
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=20170523002507.GA16670@embeddedgus \
--to=garsilva@embeddedor.com \
--cc=andi.shyti@samsung.com \
--cc=broonie@kernel.org \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/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).