Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp778803imm; Wed, 23 May 2018 05:31:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqxP18rONUVqjS5MDxoanYE2do9fRlDfVYAuEZS7k2l2LMdxRoJm4J8ljiR1iq8XRU9CTUI X-Received: by 2002:a17:902:5502:: with SMTP id f2-v6mr2799771pli.108.1527078692446; Wed, 23 May 2018 05:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527078692; cv=none; d=google.com; s=arc-20160816; b=TzOcIUWzLCpgHVyEmqpONkl8tMbVM7u7Ed3WZjc+BTgKXjUvlfjdna8Uy5GbdPGgXj hyXqEojGMA6ch8aQf7+oMFCW4PKmTduPTjjd8VA/kNUR68lcsiMIGL90fGw/z3+qAVI7 ganOpNEv3FWq7rpOhogqjvE8RGRtEKTN/6dKwOIoEG4MC0Bhx+66fldU+FZKlmSCbOEB Gp4ckOtMw8zZXK9aLGQiyrb8FwJcqqd4kzSwIEjNiHaObdkzA+ve0UeGW0izKRu8r1mi RvXAcW1OOLPUSVQCJGMcuMVjNyphNbriWjRpHN5FqeXSr00+2KyquTLZiGr7rR4IYcOi n4/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=xV65wi6VkqYngGogi1AvBovTdcfUQr1ny5Ipm9Za67s=; b=Wr16H8B6CguVlhJckW81UpEB3NE6OygxfJ7ni4WDeB1uN4DVGWlzKr7MGXIEXhsT6h EuBphrCCUJpBpz73xFPzMKuocBLG46pR2F7T5dhjKy4aRMmGhcD3LEBOPmgRx2wy2rs4 Tc7QYte64/Tounrzv4WlJhOvMgna6DVESvhQM4Cq3hbWj7InYJ6+eeuRGjblOFN3SfCw txpnj8Cmzc6XSJ4lSxKQ+pmwEDm2ZdWwprigXQw0dlvjXNyzuG5V2Fu5M9z3tO9TqW08 984Jy8/ph65eLbpz8xHYAhWkMaqPRlBFJ8GOnZQcJutdeUCX8e1zvAq4gpMmg3xZskzt Mm+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=QGvyQJm9; dkim=pass header.i=@codeaurora.org header.s=default header.b=QGvyQJm9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1-v6si18873087plb.204.2018.05.23.05.31.12; Wed, 23 May 2018 05:31:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=QGvyQJm9; dkim=pass header.i=@codeaurora.org header.s=default header.b=QGvyQJm9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932744AbeEWMav (ORCPT + 99 others); Wed, 23 May 2018 08:30:51 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45226 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932070AbeEWMat (ORCPT ); Wed, 23 May 2018 08:30:49 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9AB1660618; Wed, 23 May 2018 12:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527078648; bh=Zvf5MrutxvpG6g3mh1WNgiI6OpXX+ZSWsnFt1WhJquk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=QGvyQJm9mRAWC097y46apy2HYOjfsnaUVEfu+1Y57CddW+ejH1Z7N7/Om7Qk7gg5s nXM6YZooONoEvq+n7Y/UeNgbiL6lrJAxBZrfXCfA5fqD5oLQoVMpqEj4//akbQO+lq o89ElI/VzMUcLZSldnh1wAuaO9VAP3aIDoeJz2iU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,FROM_LOCAL_NOVOWEL,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.206.16.80] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5916C602BC; Wed, 23 May 2018 12:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527078648; bh=Zvf5MrutxvpG6g3mh1WNgiI6OpXX+ZSWsnFt1WhJquk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=QGvyQJm9mRAWC097y46apy2HYOjfsnaUVEfu+1Y57CddW+ejH1Z7N7/Om7Qk7gg5s nXM6YZooONoEvq+n7Y/UeNgbiL6lrJAxBZrfXCfA5fqD5oLQoVMpqEj4//akbQO+lq o89ElI/VzMUcLZSldnh1wAuaO9VAP3aIDoeJz2iU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5916C602BC Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=rplsssn@codeaurora.org Subject: Re: [PATCH v8 08/10] drivers: qcom: rpmh: allow requests to be sent asynchronously To: Doug Anderson , Lina Iyer Cc: Andy Gross , David Brown , linux-arm-msm@vger.kernel.org, "open list:ARM/QUALCOMM SUPPORT" , Rajendra Nayak , msivasub@codeaurora.org, mkshah@codeaurora.org, Bjorn Andersson , LKML , Stephen Boyd , Evan Green , Matthias Kaehlcke References: <20180509170159.29682-1-ilina@codeaurora.org> <20180509170159.29682-9-ilina@codeaurora.org> From: Raju P L S S S N Message-ID: <7384b854-1930-8a52-a0df-d3ef9cde8f42@codeaurora.org> Date: Wed, 23 May 2018 18:00:40 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 5/12/2018 1:46 AM, Doug Anderson wrote: > Hi, > > On Wed, May 9, 2018 at 10:01 AM, Lina Iyer wrote: >> /** >> @@ -137,6 +140,8 @@ void rpmh_tx_done(const struct tcs_request *msg, int r) >> dev_err(rpm_msg->dev, "RPMH TX fail in msg addr=%#x, err=%d\n", >> rpm_msg->msg.cmds[0].addr, r); >> >> + kfree(rpm_msg->free); >> + > > The way the code is written makes it seem like you could free memory > _and_ have a completion but you can't. Specifically: > > * The only plausible thing that "rpm_msg->free" could point to is "rpm_msg". > > * The complete(compl) would then be accessing freed memory. As the completions are declared on stack, it will not access freed memory. > > I believe the kfree() should be at the end of the function. > Personally I'd make it more obvious that this is just a boolean value > and change to: > > if (rpm_msg->needs_free) > kgree(rpm_msg) > > ...then the reader of the code doesn't need to go figure out what > you're trying to free. > > > -Doug > Yes. Will change it this way in next patch set. Thanks, Raju