From patchwork Sun Mar 6 13:39:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 8513401 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 320179FC57 for ; Sun, 6 Mar 2016 13:39:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 638BC201B4 for ; Sun, 6 Mar 2016 13:39:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E701201B9 for ; Sun, 6 Mar 2016 13:39:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751464AbcCFNjv (ORCPT ); Sun, 6 Mar 2016 08:39:51 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:33365 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751407AbcCFNjs (ORCPT ); Sun, 6 Mar 2016 08:39:48 -0500 Received: from [179.179.52.194] (helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1acYuQ-00013p-OH; Sun, 06 Mar 2016 13:39:47 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.86) (envelope-from ) id 1acYu3-0002Ga-U3; Sun, 06 Mar 2016 10:39:23 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Hans de Goede Subject: [PATCH 5/6] [media] touptek: don't DMA at the stack Date: Sun, 6 Mar 2016 10:39:21 -0300 Message-Id: <03e3125996244a85493652e8675dbb1b66e8ead4.1457271549.git.mchehab@osg.samsung.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <076989c7736719982a1bc9557d7db072910d8efe.1457271549.git.mchehab@osg.samsung.com> References: <076989c7736719982a1bc9557d7db072910d8efe.1457271549.git.mchehab@osg.samsung.com> In-Reply-To: <076989c7736719982a1bc9557d7db072910d8efe.1457271549.git.mchehab@osg.samsung.com> References: <076989c7736719982a1bc9557d7db072910d8efe.1457271549.git.mchehab@osg.samsung.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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");