Re: Build scatterlist covering a process' text segment?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 17, 2011 at 06:18:06PM +0300, Metin KAYA wrote:
> Jonathan, it's kmalloc(), not kcalloc().

No, I was trying to suggest using kcalloc(), which behaves roughly like
the userspace calloc, and implements overflow checking, which you may
need and zeroing, which you don't seem to need.

(see include/linux/slab.h, line 223 for reference)

> 
> On 17 Haz 2011, at 18:10, Jonathan Neuschäfer <j.neuschaefer@xxxxxxx> wrote:
> 
> > On Fri, Jun 17, 2011 at 02:47:25AM +0200, Arvid Brodin wrote:
> > [...]
> >>    /**** User page code ****/
> >> 
> >>    pages = kmalloc(nr_pages * sizeof(*pages), GFP_KERNEL);
> > 
> > kcalloc?
> > 
> > You don't need the zeroing but the overflow check might be useful.
> > 
> >>    if (!pages) {
> >>        retval = -ENOMEM;
> >>        goto err_pages;
> >>    }
> > 
> > Greetings,
> >    Jonathan Neuschäfer

HTH,
	Jonathan Neuschäfer

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux