From patchwork Mon Jul 18 17:54:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Vincent_Stehl=C3=A9?= X-Patchwork-Id: 9234973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A081460756 for ; Mon, 18 Jul 2016 17:59:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95D79205AD for ; Mon, 18 Jul 2016 17:59:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A937205B0; Mon, 18 Jul 2016 17:59:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40A93205AD for ; Mon, 18 Jul 2016 17:59:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbcGRR7c (ORCPT ); Mon, 18 Jul 2016 13:59:32 -0400 Received: from smtpfb1-g21.free.fr ([212.27.42.9]:54506 "EHLO smtpfb1-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbcGRR7a (ORCPT ); Mon, 18 Jul 2016 13:59:30 -0400 X-Greylist: delayed 311 seconds by postgrey-1.27 at vger.kernel.org; Mon, 18 Jul 2016 13:59:29 EDT Received: from smtp3-g21.free.fr (smtp3-g21.free.fr [212.27.42.3]) by smtpfb1-g21.free.fr (Postfix) with ESMTP id 1307777C40A; Mon, 18 Jul 2016 19:54:19 +0200 (CEST) Received: from romuald.bergerie (unknown [88.178.86.202]) by smtp3-g21.free.fr (Postfix) with ESMTPS id AD2E213F8B6; Mon, 18 Jul 2016 17:59:03 +0200 (CEST) Received: from radicelle.bergerie (radicelle.bergerie [192.168.124.12]) by romuald.bergerie (Postfix) with SMTP id 2B592154D922; Mon, 18 Jul 2016 19:54:14 +0200 (CEST) Received: by radicelle.bergerie (sSMTP sendmail emulation); Mon, 18 Jul 2016 19:54:14 +0200 From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= To: linux-media@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, =?UTF-8?q?Vincent=20Stehl=C3=A9?= , Marek Szyprowski , Sylwester Nawrocki Subject: [PATCH next] [media] vb2: Fix allocation size of dma_parms Date: Mon, 18 Jul 2016 19:54:04 +0200 Message-Id: <1468864444-19053-1-git-send-email-vincent.stehle@laposte.net> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464074167-27330-2-git-send-email-m.szyprowski@samsung.com> References: <1464074167-27330-2-git-send-email-m.szyprowski@samsung.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When allocating memory to hold the device dma parameters in vb2_dma_contig_set_max_seg_size(), the requested size is by mistake only the size of a pointer. Request the correct size instead. Fixes: 3f0339691896 ("media: vb2-dma-contig: add helper for setting dma max seg size") Signed-off-by: Vincent Stehlé Cc: Marek Szyprowski Cc: Sylwester Nawrocki Acked-by: Marek Szyprowski --- Hi, I saw that in linux next-20160718. Best regards, Vincent. drivers/media/v4l2-core/videobuf2-dma-contig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index b09b2c9..59fa204 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -743,7 +743,7 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_memops); int vb2_dma_contig_set_max_seg_size(struct device *dev, unsigned int size) { if (!dev->dma_parms) { - dev->dma_parms = kzalloc(sizeof(dev->dma_parms), GFP_KERNEL); + dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL); if (!dev->dma_parms) return -ENOMEM; }