}
static int kimage_load_crash_segment(struct kimage *image,	struct kexec_segment *segment){	/* For crash dumps kernels we simply copy the data from	 * user space to it's destination.	 * We do things a page at a time for the sake of kmap.	 */	unsigned long maddr;	unsigned long ubytes, mbytes;	int result;	unsigned char *buf;	result = 0;	buf = segment->buf;	ubytes = segment->bufsz;	mbytes = segment->memsz;	maddr = segment->mem;	while(mbytes) {		struct page *page;		char *ptr;		size_t uchunk, mchunk;		page = pfn_to_page(maddr >> PAGE_SHIFT);		if (page == 0) {			result  = -ENOMEM;			goto out;		}		ptr = kmap(page);		ptr += maddr & ~PAGE_MASK;		mchunk = PAGE_SIZE - (maddr & ~PAGE_MASK);		if (mchunk > mbytes) {			mchunk = mbytes;		}		uchunk = mchunk;		if (uchunk > ubytes) {			uchunk = ubytes;			/* Zero the trailing part of the page */			memset(ptr + uchunk, 0, mchunk - uchunk);		}		result = copy_from_user(ptr, buf, uchunk);		kunmap(page);		if (result) {			result = (result < 0) ? result : -EIO;			goto out;		}		ubytes -= uchunk;		maddr  += mchunk;		buf    += mchunk;		mbytes -= mchunk;	} out:	return result;}