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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 2 Jun 2008 09:29:52 -0600
From:	Bjorn Helgaas <bjorn.helgaas@...com>
To:	Rene Herman <rene.herman@...access.nl>
Cc:	Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org, Adam Belay <ambx1@....rr.com>,
	Adam M Belay <abelay@....edu>,
	Li Shaohua <shaohua.li@...el.com>,
	Matthieu Castet <castet.matthieu@...e.fr>,
	Thomas Renninger <trenn@...e.de>,
	Jaroslav Kysela <perex@...ex.cz>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Takashi Iwai <tiwai@...e.de>
Subject: Re: [patch 11/15] PNP: centralize resource option allocations

On Sunday 01 June 2008 05:21:10 pm Rene Herman wrote:
> On 31-05-08 00:49, Bjorn Helgaas wrote:
> 
> > This patch moves all the option allocations (pnp_mem, pnp_port, etc)
> > into the pnp_register_{mem,port,irq,dma}_resource() functions.  This
> > will make it easier to rework the option data structures.
> > 
> > The non-trivial part of this patch is the IRQ handling.  The backends
> > have to allocate a local pnp_irq_mask_t bitmap, populate it, and pass
> > a pointer to pnp_register_irq_resource().
> > 
> > Signed-off-by: Bjorn Helgaas <bjorn.helgaas@...com>
> 
> [ ... ]
> 
> > Index: work10/drivers/pnp/isapnp/core.c
> > ===================================================================
> > --- work10.orig/drivers/pnp/isapnp/core.c	2008-05-30 13:20:36.000000000 -0600
> > +++ work10/drivers/pnp/isapnp/core.c	2008-05-30 13:23:34.000000000 -0600
> > @@ -433,20 +433,23 @@ static void __init isapnp_parse_irq_reso
> >  					     int size)
> >  {
> >  	unsigned char tmp[3];
> > -	struct pnp_irq *irq;
> >  	unsigned long bits;
> > +	int i;
> > +	pnp_irq_mask_t map;
> > +	unsigned char flags = IORESOURCE_IRQ_HIGHEDGE;
> >  
> >  	isapnp_peek(tmp, size);
> > -	irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL);
> > -	if (!irq)
> > -		return;
> >  	bits = (tmp[1] << 8) | tmp[0];
> > -	bitmap_copy(irq->map.bits, &bits, 16);
> > +
> > +	bitmap_zero(map.bits, PNP_IRQ_NR);
> > +	for (i = 0; i < 15; i++)
> > +		if (bits & (1 << i))
> > +			__set_bit(i, map.bits);
> > +
> 
> for (i = 0; i < 16; i++) (16 instead of 15) it would seem.

Oops, typo on my part.

> And why not simply:
> 
> bitmap_zero(map.bits, PNP_IRQ_NR);
> bitmap_copy(map.bits, &bits, 16);
> 
> That last bit of the comment same for pnpbios_parse_irq_option(). Should 
>   be fine, no?

I suppose it should be fine.  It's just that I was new to the bitmap
functions and nervous about copying between bitmaps of different sizes
and getting bits in the correct places.  But I'll try to get over my
paranoia :-)

Bjorn
--
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