All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: keyrings@vger.kernel.org, Jason@zx2c4.com,
	herbert@gondor.apana.org.au, k.marinushkin@gmail.com,
	linux-crypto@vger.kernel.org
Subject: Re: [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #2]
Date: Fri, 16 Feb 2018 01:56:29 +0000	[thread overview]
Message-ID: <20180216015629.GA136603@gmail.com> (raw)
In-Reply-To: <151873522941.16065.2576464502758911341.stgit@warthog.procyon.org.uk>

Hi David,

On Thu, Feb 15, 2018 at 10:53:49PM +0000, David Howells wrote:
>  /*
> + * Free up the buffer.
> + */
> +static void big_key_free_buffer(struct big_key_buf *buf)
> +{
> +	unsigned int i;
> +
> +	vunmap(buf->virt);
> +	for (i = 0; i < buf->nr_pages; i++)
> +		if (buf->pages[i])
> +			__free_page(buf->pages[i]);
> +
> +	memset(buf->virt, 0, buf->nr_pages * PAGE_SIZE);
> +	kfree(buf);
> +}

memset() after vunmap(), and also when buf->virt can be NULL?  I had suggested:

        if (buf->virt) {
                memset(buf->virt, 0, buf->nr_pages * PAGE_SIZE);
                vunmap(buf->virt);
        }

- Eric

WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers3@gmail.com>
To: David Howells <dhowells@redhat.com>
Cc: keyrings@vger.kernel.org, Jason@zx2c4.com,
	herbert@gondor.apana.org.au, k.marinushkin@gmail.com,
	linux-crypto@vger.kernel.org
Subject: Re: [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #2]
Date: Thu, 15 Feb 2018 17:56:29 -0800	[thread overview]
Message-ID: <20180216015629.GA136603@gmail.com> (raw)
In-Reply-To: <151873522941.16065.2576464502758911341.stgit@warthog.procyon.org.uk>

Hi David,

On Thu, Feb 15, 2018 at 10:53:49PM +0000, David Howells wrote:
>  /*
> + * Free up the buffer.
> + */
> +static void big_key_free_buffer(struct big_key_buf *buf)
> +{
> +	unsigned int i;
> +
> +	vunmap(buf->virt);
> +	for (i = 0; i < buf->nr_pages; i++)
> +		if (buf->pages[i])
> +			__free_page(buf->pages[i]);
> +
> +	memset(buf->virt, 0, buf->nr_pages * PAGE_SIZE);
> +	kfree(buf);
> +}

memset() after vunmap(), and also when buf->virt can be NULL?  I had suggested:

        if (buf->virt) {
                memset(buf->virt, 0, buf->nr_pages * PAGE_SIZE);
                vunmap(buf->virt);
        }

- Eric

  reply	other threads:[~2018-02-16  1:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 15:54 [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers David Howells
2018-02-15 15:54 ` David Howells
2018-02-15 20:45 ` Eric Biggers
2018-02-15 20:45   ` Eric Biggers
2018-02-15 21:36   ` David Howells
2018-02-15 22:53 ` [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #2] David Howells
2018-02-15 22:53   ` David Howells
2018-02-16  1:56   ` Eric Biggers [this message]
2018-02-16  1:56     ` Eric Biggers
2018-02-16  9:05     ` David Howells
2018-02-16  9:41 ` [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #3] David Howells
2018-02-16  9:41   ` David Howells

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=20180216015629.GA136603@gmail.com \
    --to=ebiggers3@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=k.marinushkin@gmail.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.