Unverified Commit e81a12ab authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10727 net/iucv: Avoid explicit cpumask var allocation on stack

parents 67e98231 0d8f5e00
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -517,7 +517,7 @@ static void iucv_setmask_mp(void)
 */
static void iucv_setmask_up(void)
{
	cpumask_t cpumask;
	static cpumask_t cpumask;
	int cpu;

	/* Disable all cpu but the first in cpu_irq_cpumask. */
@@ -625,23 +625,33 @@ static int iucv_cpu_online(unsigned int cpu)

static int iucv_cpu_down_prep(unsigned int cpu)
{
	cpumask_t cpumask;
	cpumask_var_t cpumask;
	int ret = 0;

	if (!iucv_path_table)
		return 0;

	cpumask_copy(&cpumask, &iucv_buffer_cpumask);
	cpumask_clear_cpu(cpu, &cpumask);
	if (cpumask_empty(&cpumask))
	if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
		return -ENOMEM;

	cpumask_copy(cpumask, &iucv_buffer_cpumask);
	cpumask_clear_cpu(cpu, cpumask);
	if (cpumask_empty(cpumask)) {
		/* Can't offline last IUCV enabled cpu. */
		return -EINVAL;
		ret = -EINVAL;
		goto __free_cpumask;
	}

	iucv_retrieve_cpu(NULL);
	if (!cpumask_empty(&iucv_irq_cpumask))
		return 0;
		goto __free_cpumask;

	smp_call_function_single(cpumask_first(&iucv_buffer_cpumask),
				 iucv_allow_cpu, NULL, 1);
	return 0;

__free_cpumask:
	free_cpumask_var(cpumask);
	return ret;
}

/**