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] [day] [month] [year] [list]
Date:	Fri, 2 Feb 2007 11:58:19 +0100
From:	Oliver Neukum <oneukum@...e.de>
To:	Oleg Verych <olecom@...wer.upol.cz>,
	Pekka J Enberg <penberg@...helsinki.fi>, lirc@...telmus.de
Cc:	linux-kernel@...r.kernel.org
Subject: Re: lirc: igorplususb error handling cleanup


> > -	/* allocate kernel memory */
> > -	mem_failure = 0;
> > -	if (!(ir = kmalloc(sizeof(struct irctl), GFP_KERNEL))) {
> > -		mem_failure = 1;
> > -	} else {
> > -		memset(ir, 0, sizeof(struct irctl));
> > -
> > -		if (!(plugin = kmalloc(sizeof(struct lirc_plugin), GFP_KERNEL))) {
> > -			mem_failure = 2;
> > -		} else if (!(rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL))) {
> > -			mem_failure = 3;
> 
> If size of all structs, allocated here is 3-4 pages (say, 4096 bytes
> one), then, i think something like, allocating all at once may be
> utilized:
> 
> ,-*-
> |struct ir_stuff_t {
> |       struct irctl *ir;
> |       struct lirc_plugin *plugin;
> |       struct lirc_buffer *rbuf;

I guess you mean 
struct lirc_buffer rbuf;
without the "*"

> |} ir_stuff;
> |
> |ir_stuff = kzalloc(...);
> |
> |if(!ir_stuff)
> |       error;
> `-*-       
> 
> then join buffer init, usb init together and final register, after
> it. Thus to have second erroneous path.

If I understand this code correctly the allocated buffers end up as
buffers used in URBs. If that is the case you must allocate each of
them separately with kmalloc() or usb_alloc_buffer() or you violate
DMA constraints on non-coherent architectures (eg. ppc)

	Regards
		Oliver
-
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