All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 5/6] [media] touptek: don't DMA at the stack
Date: Sun,  6 Mar 2016 10:39:21 -0300	[thread overview]
Message-ID: <03e3125996244a85493652e8675dbb1b66e8ead4.1457271549.git.mchehab@osg.samsung.com> (raw)
In-Reply-To: <076989c7736719982a1bc9557d7db072910d8efe.1457271549.git.mchehab@osg.samsung.com>
In-Reply-To: <076989c7736719982a1bc9557d7db072910d8efe.1457271549.git.mchehab@osg.samsung.com>

As warned by smatch:
	drivers/media/usb/gspca/touptek.c:220 reg_w() error: doing dma on the stack (buff)
	drivers/media/usb/gspca/touptek.c:458 configure() error: doing dma on the stack (buff)

This can fail, as the stack may not be in a memory that would
allod DMA. So, use the usb_buf instead.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 drivers/media/usb/gspca/touptek.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/gspca/touptek.c b/drivers/media/usb/gspca/touptek.c
index 7bac6bc96063..8063b8e45ee5 100644
--- a/drivers/media/usb/gspca/touptek.c
+++ b/drivers/media/usb/gspca/touptek.c
@@ -211,7 +211,7 @@ static int val_reply(struct gspca_dev *gspca_dev, const char *reply, int rc)
 
 static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
 {
-	char buff[1];
+	char *buff = gspca_dev->usb_buf;
 	int rc;
 
 	PDEBUG(D_USBO,
@@ -438,7 +438,7 @@ static void configure_encrypted(struct gspca_dev *gspca_dev)
 static int configure(struct gspca_dev *gspca_dev)
 {
 	int rc;
-	uint8_t buff[4];
+	char *buff = gspca_dev->usb_buf;
 
 	PDEBUG(D_STREAM, "configure()\n");
 
-- 
2.5.0


  parent reply	other threads:[~2016-03-06 13:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06 13:39 [PATCH 1/6] [media] mantis: check for errors on readl inside loop Mauro Carvalho Chehab
2016-03-06 13:39 ` [PATCH 2/6] [media] ddcore: avoid endless loop if readl() fails Mauro Carvalho Chehab
2016-03-06 13:39 ` [PATCH 3/6] [media] mceusb: use %*ph for small buffer dumps Mauro Carvalho Chehab
2016-03-06 13:39 ` [PATCH 4/6] [media] st-rc: prevent a endless loop Mauro Carvalho Chehab
2016-03-06 13:39   ` Mauro Carvalho Chehab
2016-03-07  8:16   ` Patrice Chotard
2016-03-07  8:16     ` Patrice Chotard
2016-03-06 13:39 ` Mauro Carvalho Chehab [this message]
2016-03-06 13:39 ` [PATCH 6/6] [media] touptek: cast char types on %x printk Mauro Carvalho Chehab

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=03e3125996244a85493652e8675dbb1b66e8ead4.1457271549.git.mchehab@osg.samsung.com \
    --to=mchehab@osg.samsung.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.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 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.