From patchwork Thu Jun 15 16:31:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 9789175 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 6DD1A60384 for ; Thu, 15 Jun 2017 16:36:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EFEE28698 for ; Thu, 15 Jun 2017 16:36:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5143C286C2; Thu, 15 Jun 2017 16:36:00 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable 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 DE57128698 for ; Thu, 15 Jun 2017 16:35:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752738AbdFOQfz (ORCPT ); Thu, 15 Jun 2017 12:35:55 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38555 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752640AbdFOQd1 (ORCPT ); Thu, 15 Jun 2017 12:33:27 -0400 Received: by mail-wm0-f54.google.com with SMTP id n195so4100466wmg.1 for ; Thu, 15 Jun 2017 09:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LddNM0B7BF2Q1NR9owPFwmfghKr/CobKCgYvCgn0VcA=; b=FKWjbfZhz+ibSuga+28GvIX7NpiZt8TqK6phg/87VxeiGT7R0rQRDJq7rNgDFvGZHc dm/J3ZXBek67r+wlz+UO6c1TbcGKIoudNDw2DaJ7h+MIQBMbny4gWjVSH+ebeQwgWJK7 s/9ABWAkmrIQzxIhMnoTRM7rhriY7q+1QkOUg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LddNM0B7BF2Q1NR9owPFwmfghKr/CobKCgYvCgn0VcA=; b=YGgqMJNcg1rD5A2wSkF2cQroLK44GQm80UgQK176Fwx6VvWOwmNakKa9wSC15N66do uJ3Lr0AAdjo71CrbQXmKiKQ7AautNW4biVaEXX7Je7MjdYjPpaGjfGRqiVX148CNrbT1 Z9TRQYjD0HsD/ePvpbte4bPYSQk45s7BSEfbO49lhKltAHZ6/qDmH/Lj3WBhrhwA6XAq wQY/VYeqbXOvNxuP7AlcHZC70X6e2BcCquN+cT2rg7Pj15hDTfzUyCyQGvv6wcf+QiVh lh7DAgrtjc5aIBg8TkVEKtG9kSVeTgATS2KJyhuXljHAcaD4KMVmpKQm+p0iawWqPoCG WPJg== X-Gm-Message-State: AKS2vOwvLJ/twuGkW00xBBRhB5UTPAI+BknO1dfeYmOgW/cd9RUl7xYU U0FkI+kMPLfzCihn X-Received: by 10.28.66.86 with SMTP id p83mr4361511wma.31.1497544396183; Thu, 15 Jun 2017 09:33:16 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id m73sm541890wmi.25.2017.06.15.09.33.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Jun 2017 09:33:15 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stanimir Varbanov Subject: [PATCH v11 15/19] media: venus: vdec: fix compile error in vdec_close Date: Thu, 15 Jun 2017 19:31:56 +0300 Message-Id: <1497544320-2269-16-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497544320-2269-1-git-send-email-stanimir.varbanov@linaro.org> References: <1497544320-2269-1-git-send-email-stanimir.varbanov@linaro.org> 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 This fixes the following compile error ocured when building with gcc7: drivers/media/platform/qcom/venus/vdec.c:1022 vdec_close() error: dereferencing freed memory 'inst' by moving kfree as a last call. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 96e7e7e71e5f..594315b55b1f 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1017,9 +1017,10 @@ static int vdec_close(struct file *file) mutex_destroy(&inst->lock); v4l2_fh_del(&inst->fh); v4l2_fh_exit(&inst->fh); - kfree(inst); pm_runtime_put_sync(inst->core->dev_dec); + + kfree(inst); return 0; }