From patchwork Mon Jun 12 16:27:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 9782099 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 08CC260352 for ; Mon, 12 Jun 2017 16:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1B4528178 for ; Mon, 12 Jun 2017 16:31:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6B42283C0; Mon, 12 Jun 2017 16:31:40 +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 8BE2328178 for ; Mon, 12 Jun 2017 16:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754733AbdFLQbh (ORCPT ); Mon, 12 Jun 2017 12:31:37 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:33966 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805AbdFLQaE (ORCPT ); Mon, 12 Jun 2017 12:30:04 -0400 Received: by mail-wr0-f169.google.com with SMTP id g76so101845672wrd.1 for ; Mon, 12 Jun 2017 09:30:03 -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=bAAlCTgsIBpJQGPhPlOjby8HlVU+w5KWMZ/W+3y1okBH1bIeP2uhy/ddbZXAOCzUtH 0xM9IY2IS0TEq+GKjU3OM2d9c9gGOWI+RRViv5EUMBxTeCNlpoII/MiJqgGFkcmROOZc Mhew3ubpm7CivP8ioukBalKPFMpBoa/rPAJNQ= 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=WRQKQQX555SDLHsBGeZfOMOG6I/rdCYLsfoyPZkaFuRVXod7DuolS81vRXhGcIuBCX F5aHy9bZPDhFnwMH9mA4otB1yU/Y/S4PiDXkqE2ftFsZR5DiTuTLRwAgXNi0QsJQ1McB Kg0QIe/zRntYBxPAaTF+Mbafr4QZWrbBpYrRDENvM8w//0XzaDPRVm7zyzAAlG4o9Ama 6o0tb7OukRWdsQkgDyxfRAiXRaA4Uc3/y/oRsq0dE5O/eFqZGUt7WtensJ6795+CMGDz m0ppKN1PTyfrciOq8tM5xGleEC+IlamauYc/e+Z8fI7kRFI/crjIeEmliTJnLuLkGmmz 8GcA== X-Gm-Message-State: AKS2vOw/E7ihPdDAjGJqHZXMB7wDmendUGWBiTv/t53r6CkimIS33+af KfWmwojsWYVG06g6 X-Received: by 10.223.163.93 with SMTP id d29mr8358139wrb.95.1497284996839; Mon, 12 Jun 2017 09:29:56 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 49sm14493531wrz.8.2017.06.12.09.29.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Jun 2017 09:29:56 -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 v10 15/18] media: venus: vdec: fix compile error in vdec_close Date: Mon, 12 Jun 2017 19:27:52 +0300 Message-Id: <1497284875-19999-16-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497284875-19999-1-git-send-email-stanimir.varbanov@linaro.org> References: <1497284875-19999-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; }