linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Denis Efremov <efremov@linux.com>, Joe Perches <joe@perches.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: Use previously computed array_size()
Date: Mon, 1 Jun 2020 10:46:47 +0200	[thread overview]
Message-ID: <cbf8741e-ede4-af17-309c-666b52883b17@redhat.com> (raw)
In-Reply-To: <6088fa0f-668a-f221-515b-413ca8c0c363@linux.com>

On 30/05/20 19:28, Denis Efremov wrote:
>> On Sat, 2020-05-30 at 17:35 +0300, Denis Efremov wrote:
>>> array_size() is used in alloc calls to compute the allocation
>>> size. Next, "raw" multiplication is used to compute the size
>>> for copy_from_user(). The patch removes duplicated computation
>>> by saving the size in a var. No security concerns, just a small
>>> optimization.
>>>
>>> Signed-off-by: Denis Efremov <efremov@linux.com>
>> Perhaps use vmemdup_user?
> vmemdup_user() uses kvmalloc internally. I think it will also require
> changing vfree to kvfree.
> 

Yes, it would be a good idea.

Paolo


  reply	other threads:[~2020-06-01  8:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30 14:35 [PATCH] KVM: Use previously computed array_size() Denis Efremov
2020-05-30 15:58 ` Joe Perches
2020-05-30 17:28   ` Denis Efremov
2020-06-01  8:46     ` Paolo Bonzini [this message]
2020-06-03 10:11   ` [PATCH] KVM: Use vmemdup_user() Denis Efremov
2020-06-04 18:41     ` Paolo Bonzini
2021-06-18  0:25     ` Jim Mattson
2021-06-18  6:00       ` Michal Hocko
2021-06-18 16:53         ` Jim Mattson
2021-06-18 17:04           ` Michal Hocko
2021-06-18 17:32             ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbf8741e-ede4-af17-309c-666b52883b17@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=efremov@linux.com \
    --cc=joe@perches.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sean.j.christopherson@intel.com \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).