if ((flags & KEXEC_ON_CRASH) == 0) { result = kimage_normal_alloc(&image, entry, nr_segments, segments); } 
if ((flags & KEXEC_ON_CRASH) == 0) result = kimage_normal_alloc(&image, entry, nr_segments, segments); 
asmlinkage long sys_kexec_load(unsigned long entry,	unsigned long nr_segments, struct kexec_segment __user *segments,	unsigned long flags){	struct kimage **dest_image, *image;	int locked;	int result;	/* We only trust the superuser with rebooting the system. */	if (!capable(CAP_SYS_BOOT))		return -EPERM;	/*	 * Verify we have a legal set of flags	 * This leaves us room for future extensions.	 */	if ((flags & KEXEC_FLAGS) != (flags & ~KEXEC_ARCH_MASK))		return -EINVAL;	/* Verify we are on the appropriate architecture */	if (((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH) &&		((flags & KEXEC_ARCH_MASK) != KEXEC_ARCH_DEFAULT))	{		return -EINVAL;	}	/* Put an artificial cap on the number	 * of segments passed to kexec_load.	 */	if (nr_segments > KEXEC_SEGMENT_MAX)		return -EINVAL;	image = NULL;	result = 0;	/* Because we write directly to the reserved memory	 * region when loading crash kernels we need a mutex here to	 * prevent multiple crash  kernels from attempting to load	 * simultaneously, and to prevent a crash kernel from loading	 * over the top of a in use crash kernel.	 *	 * KISS: always take the mutex.	 */	locked = xchg(&kexec_lock, 1);	if (locked) {		return -EBUSY;	}	dest_image = &kexec_image;	if (flags & KEXEC_ON_CRASH) {		dest_image = &kexec_crash_image;	}	if (nr_segments > 0) {		unsigned long i;		/* Loading another kernel to reboot into */		if ((flags & KEXEC_ON_CRASH) == 0) {			result = kimage_normal_alloc(&image, entry, nr_segments, segments);		}		/* Loading another kernel to switch to if this one crashes */		else if (flags & KEXEC_ON_CRASH) {			/* Free any current crash dump kernel before			 * we corrupt it.			 */			kimage_free(xchg(&kexec_crash_image, NULL));			result = kimage_crash_alloc(&image, entry, nr_segments, segments);		}		if (result) {			goto out;		}		result = machine_kexec_prepare(image);		if (result) {			goto out;		}		for(i = 0; i < nr_segments; i++) {			result = kimage_load_segment(image, &image->segment[i]);			if (result) {				goto out;			}		}		result = kimage_terminate(image);		if (result) {			goto out;		}	}	/* Install the new kernel, and  Uninstall the old */	image = xchg(dest_image, image); out:	xchg(&kexec_lock, 0); /* Release the mutex */	kimage_free(image);	return result;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/72414d3f1d22fc3e311b162fca95c430048d38ce/kexec.c/buggy/kernel/kexec.c