Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp602159pxk; Wed, 9 Sep 2020 13:43:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdZ6Q/TuzgtU5bUKDcAZMd42NSevrHi41fhlHB5Iq5eavadcbtEEinmNqEViJK5j7ebNfG X-Received: by 2002:a05:6402:3192:: with SMTP id di18mr6101998edb.116.1599684233105; Wed, 09 Sep 2020 13:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599684233; cv=none; d=google.com; s=arc-20160816; b=Zc0yEc0iVC2Z4Bf0PE8jkfXrXEckI3JT68CKe14Lzu9YU9WwUn4Nsu/iEXPQlA7AFg sdsej1JMntru+9IaGn3WuESBtAKIHcJPg4acLQD8HZ5xBbo0tozNn6Tvo90qVINMVI3/ 0dNjInosGmRaWxrsyFDD1swn+2y14OMmTC66oazs4dNKNtuzM2AkcpmOnfy1WJkRSOgs RhdVVZrR3ttM8utpHxCdkjxHDVyNnE8u5eYMduyoREYkC/r5VvxGLUCpw4nXd51UkCK/ mZ7P1nyX16ZFDr2I568lAr4eYKkfNgj7Ww8M0iZbuMfbJaKkIGkYQmxWmVUUHRvaX3Zi G3hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=sx9DxKNcCvmTYkO3aEWVaC2c0HdBPnZtG5c75JMGmnk=; b=TPFNsb+Tas9wjRg6jD0pnAVoQ8JSQcQNobOtt/LBcDF7ZlRXtbs857p4lCqirdN6wT nv0/uNTOXoCegMEoIHiEk7hKdWOOJuDMHKBsIoxbS1n6RMY9ThTRwSMfW10zE/1Z/hQZ E3SbuJqm4YiFUG6hl2FiD6KtTUNS7r1PysL5QZ1E6qdkQhikT6rmE1Xh1bTsQ3kIAss+ 26VJVZEJwuPmk8eOLXrqx9ykYoDD+95ixwIXdDc5S3itCkE1AQkw11MnOi+D23/gS24N aadyawJzWWHkWB3ddmnM82uqJHu/TNy2itCHQ7q6E4T+fr6tS/3XUy4RyTlvMjlDqAhQ DhMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cCjgWXD9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si2076085ejx.520.2020.09.09.13.43.29; Wed, 09 Sep 2020 13:43:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cCjgWXD9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729251AbgIIUkc (ORCPT + 99 others); Wed, 9 Sep 2020 16:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726414AbgIIUkb (ORCPT ); Wed, 9 Sep 2020 16:40:31 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 201FFC061573; Wed, 9 Sep 2020 13:40:31 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id x23so3555068wmi.3; Wed, 09 Sep 2020 13:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=sx9DxKNcCvmTYkO3aEWVaC2c0HdBPnZtG5c75JMGmnk=; b=cCjgWXD94wPoS66QQU9Z0vA15zknGbe0JEz39WrKjO9NLwCV2CaUItI9bor3duj6HD Ij1XN9gmTNyo7dk9OTp9orN1Lx/6TVIml6JOuYLtRkL3j2YPz7QeihVQ+w9F2gWtv0k6 e5mmPDocAfHTE2wqhOs5JiL0IqPP1m75Qfv/gtsQmYGWxJ8681vNSmAkynXJsvH6D1CV HcCTTEQOOPsC0An4L2itudcRCEfME6GeevxNbJYE1UkMZPh3F/UZdSMA+fpaUWdvgDCw j/n5xvs4d4m0hf0Iz6jrWIpQD6TwSfYyBQKjf4uC6Yb7j1hKJr2gXlodnlW8jUaZIyYA mBsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=sx9DxKNcCvmTYkO3aEWVaC2c0HdBPnZtG5c75JMGmnk=; b=Fe8yKJo2p1scMpKL2SmeZBGXoTZOxQAKzN9C5SQw3TnHf4zWAGwO1Gu/p9dB3BeaW4 AP1cJDzWn716IbpajC0WFzc1mS3sPq+vWQy3+ugXvSaGpAeW9yq19pJf/4zo1BabEDfq JWpBft2m7yhd+VAUuWMfhQUcj+BWz5tFagQ3NtMK2SspfxYn2PnQEm7olprYbRKm97H6 2xnS/z0uRXQB9bfqqAdGlDBX5ezd3MBuAc1nwvAcrOvtHt0JAcklDCS7H0q9PwarqCzL ipN10bJN2dNqxF9wKa9920jJshzlDEzZcB9IjMatQlgyn2WFPnycPuyO5TyI11aio8Kc WBHA== X-Gm-Message-State: AOAM5311bWwnNHeioJfUEv1dWJ0X3lpx4AaCJWaibOnjC8WOXAqu6mSp 30R2teQTAMdu+AdrFVK7UWiO7RCL/WQTY61f X-Received: by 2002:a1c:c90d:: with SMTP id f13mr5290413wmb.25.1599684029611; Wed, 09 Sep 2020 13:40:29 -0700 (PDT) Received: from [192.168.0.18] (cpc83661-brig20-2-0-cust443.3-3.cable.virginm.net. [82.28.105.188]) by smtp.gmail.com with ESMTPSA id f14sm5717285wrv.72.2020.09.09.13.40.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Sep 2020 13:40:29 -0700 (PDT) Subject: Re: [PATCH] staging: media: atomisp: Use kvfree_sensitive in a few places To: Dan Carpenter Cc: devel@driverdev.osuosl.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org References: <20200909195403.225084-1-alex.dewar90@gmail.com> <20200909200651.GB12635@kadam> From: Alex Dewar Message-ID: Date: Wed, 9 Sep 2020 21:40:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200909200651.GB12635@kadam> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-09 21:06, Dan Carpenter wrote: > On Wed, Sep 09, 2020 at 08:53:50PM +0100, Alex Dewar wrote: >> In the file pci/sh_css_params.c, there are a number of places where >> memset+kvfree is used, where kvfree_sensitive could be used instead. Fix >> these occurrences. > This doesn't say *why* the commit is doing it. There are two reasons: > The worry with these is that the compiler could optimize away the memset > because it sees the kfree(). Second using kvfree_sensitive() is more > clear and readable. Good point :) > >> Issue identified with Coccinelle. >> >> Signed-off-by: Alex Dewar >> --- >> .../staging/media/atomisp/pci/sh_css_params.c | 19 +++++++------------ >> 1 file changed, 7 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c >> index 2c67c23b3700..d1b5d6608d52 100644 >> --- a/drivers/staging/media/atomisp/pci/sh_css_params.c >> +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c >> @@ -4378,8 +4378,7 @@ ia_css_3a_statistics_free(struct ia_css_3a_statistics *me) >> if (me) { >> kvfree(me->rgby_data); >> kvfree(me->data); >> - memset(me, 0, sizeof(struct ia_css_3a_statistics)); >> - kvfree(me); >> + kvfree_sensitive(me, sizeof(struct ia_css_3a_statistics)); > I don't think ia_css_3a_statistics are sensitive at all. What we're > trying to protect are things like passwords. Just delete the memset. > > Looking below, I don't think any of these are sensitive so just delete > all the memsets. This makes sense. I'll send a new patch. Thanks for the feedback! Alex > > regards, > dan carpenter >