All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Kucharski <william.kucharski@oracle.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Keith Busch <keith.busch@intel.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Kees Cook <keescook@chromium.org>,
	YueHaibing <yuehaibing@huawei.com>,
	linux-mm@kvack.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mm/gup_benchmark: prevent integer overflow in ioctl
Date: Thu, 01 Nov 2018 08:28:55 +0000	[thread overview]
Message-ID: <E7641C0F-C619-4054-BD14-685E8D448F49@oracle.com> (raw)
In-Reply-To: <20181101071613.7x3smxwz5wo57n2m@mwanda>



> On Nov 1, 2018, at 1:16 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> My patch lets people allocate 4MB.  (U32_MAX / 4096 * sizeof(void *)).
> Surely, that's enough?  I liked my check because it avoids the divide so
> it's faster and it is a no-op on 64bit systems.

It should be enough, and you're right, it does avoid extra math.

However, in that case I'd like to see a comment added so that anyone looking
at the code in the future knows why you limited the allocation to ULONG_MAX
bytes.

Thanks,
    William Kucharski

WARNING: multiple messages have this Message-ID (diff)
From: William Kucharski <william.kucharski@oracle.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Keith Busch <keith.busch@intel.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Kees Cook <keescook@chromium.org>,
	YueHaibing <yuehaibing@huawei.com>,
	linux-mm@kvack.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mm/gup_benchmark: prevent integer overflow in ioctl
Date: Thu, 1 Nov 2018 02:28:55 -0600	[thread overview]
Message-ID: <E7641C0F-C619-4054-BD14-685E8D448F49@oracle.com> (raw)
In-Reply-To: <20181101071613.7x3smxwz5wo57n2m@mwanda>



> On Nov 1, 2018, at 1:16 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> My patch lets people allocate 4MB.  (U32_MAX / 4096 * sizeof(void *)).
> Surely, that's enough?  I liked my check because it avoids the divide so
> it's faster and it is a no-op on 64bit systems.

It should be enough, and you're right, it does avoid extra math.

However, in that case I'd like to see a comment added so that anyone looking
at the code in the future knows why you limited the allocation to ULONG_MAX
bytes.

Thanks,
    William Kucharski

  reply	other threads:[~2018-11-01  8:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25  6:15 [PATCH] mm/gup_benchmark: prevent integer overflow in ioctl Dan Carpenter
2018-10-25  6:15 ` Dan Carpenter
2018-10-25  7:32 ` Kirill A. Shutemov
2018-10-25  7:32   ` Kirill A. Shutemov
2018-11-01  6:38 ` William Kucharski
2018-11-01  6:38   ` William Kucharski
2018-11-01  7:16   ` Dan Carpenter
2018-11-01  7:16     ` Dan Carpenter
2018-11-01  8:28     ` William Kucharski [this message]
2018-11-01  8:28       ` William Kucharski

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=E7641C0F-C619-4054-BD14-685E8D448F49@oracle.com \
    --to=william.kucharski@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=keescook@chromium.org \
    --cc=keith.busch@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    --cc=mst@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=yuehaibing@huawei.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 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.