lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0902171101080.21686@localhost.localdomain>
Date:	Tue, 17 Feb 2009 11:04:29 -0800 (PST)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	hpa@...or.com, mingo@...hat.com, tglx@...utronix.de, mingo@...e.hu,
	linux-kernel@...r.kernel.org
cc:	linux-tip-commits@...r.kernel.org
Subject: Re: [tip:irq/genirq] irq: refactor and clean up the free_irq() code
 flow



On Sun, 15 Feb 2009, Ingo Molnar wrote:
>  	struct irq_desc *desc = irq_to_desc(irq);
> -	struct irqaction **p;
> +	struct irqaction *action, **p, **pp;

The whole reason for 'pp' seems to be the confusing loop:

>  	for (;;) {
> +		action = *p;
> +		pp = p;
> +
> +		if (!action) {
> +			WARN(1, "Trying to free already-free IRQ %d\n", irq);
> +			spin_unlock_irqrestore(&desc->lock, flags);
> +
> +			return;
> +		}
>  
> +		p = &action->next;
> +		if (action->dev_id != dev_id)
> +			continue;
>  
> +		break;
> +	}
> +	/* Found it - now remove it from the list of entries: */
> +	*pp = action->next;

Where the need for 'pp' would go away if you'd just write it as

		if (action->dev_id == dev_id)
			break;
		p = &action->next;
	}
	*p = action->next;

instead. Which also makes it both shorter and more readable.

		Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ