[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210216182232.mmo5pwchongpmrau@intel.com>
Date: Tue, 16 Feb 2021 10:22:32 -0800
From: Ben Widawsky <ben.widawsky@...el.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: linux-cxl@...r.kernel.org, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-nvdimm@...ts.01.org,
linux-pci@...r.kernel.org, Bjorn Helgaas <helgaas@...nel.org>,
Chris Browy <cbrowy@...ry-design.com>,
Christoph Hellwig <hch@...radead.org>,
Dan Williams <dan.j.williams@...el.com>,
David Hildenbrand <david@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Ira Weiny <ira.weiny@...el.com>,
Jon Masters <jcm@...masters.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Rafael Wysocki <rafael.j.wysocki@...el.com>,
Randy Dunlap <rdunlap@...radead.org>,
Vishal Verma <vishal.l.verma@...el.com>,
"John Groves (jgroves)" <jgroves@...ron.com>,
"Kelley, Sean V" <sean.v.kelley@...el.com>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v4 4/9] cxl/mem: Add basic IOCTL interface
On 21-02-16 18:12:05, Al Viro wrote:
> On Mon, Feb 15, 2021 at 05:45:33PM -0800, Ben Widawsky wrote:
> > + if (cmd->info.size_in) {
> > + mbox_cmd.payload_in = kvzalloc(cmd->info.size_in, GFP_KERNEL);
> > + if (!mbox_cmd.payload_in) {
> > + rc = -ENOMEM;
> > + goto out;
> > + }
> > +
> > + if (copy_from_user(mbox_cmd.payload_in,
> > + u64_to_user_ptr(in_payload),
> > + cmd->info.size_in)) {
> > + rc = -EFAULT;
> > + goto out;
> > + }
>
> Umm... Do you need to open-code vmemdup_user()? The only difference is
> GFP_KERNEL allocation instead of GFP_USER one, and the latter is arguably
> saner here... Zeroing is definitely pointless - you either overwrite
> the entire buffer with copy_from_user(), or you fail and free the damn
> thing.
mea culpa. In fact it was previously memdup_user and Dan suggested I switch to
vmemdup_user.
https://lore.kernel.org/linux-cxl/CAPcyv4j+ixVgEo5q2OhV4kdkBZbnohZj3KDovReQJjPBsREugw@mail.gmail.com/
Will fix for the next version.
Thanks.
Powered by blists - more mailing lists