tmp_suning_uos_patched/drivers/input/serio
Jesper Juhl 39de52104d Input: serio HIL MLC - don't deref null, don't leak and return proper error
While reviewing various users of kernel memory allocation functions I came
across drivers/input/serio/hil_mlc.c::hil_mlc_register() and noticed that:

 - it calls kzalloc() but fails to check for a NULL return before use.
 - it makes several allocations and if one fails it doesn't free the
   previous ones.
 - It doesn't return -ENOMEM in the failed memory allocation case (it just
   crashes).

This patch corrects all of the above and also reworks the only caller of
this function that I could find
(drivers/input/serio/hp_sdc_mlc.c::hp_sdc_mlc_out()) so that it now checks
the return value of hil_mlc_register() and properly propagates it on
failure and I also restructured the code to remove some labels and goto's
to make it, IMHO nicer to read.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Tested-by: Helge Deller <deller@gmx.de>
Acked-by: Helge Deller <deller@gmx.de>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-20 13:38:18 -08:00
..
altera_ps2.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
ambakmi.c Input: ambakmi - annotate probe() and remove() methods 2009-12-11 23:45:57 -08:00
ams_delta_serio.c input: serio: add support for Amstrad Delta serial keyboardport 2010-05-05 11:11:10 -07:00
at32psif.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
ct82c710.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
gscps2.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hil_mlc.c Input: serio HIL MLC - don't deref null, don't leak and return proper error 2010-11-20 13:38:18 -08:00
hp_sdc_mlc.c Input: serio HIL MLC - don't deref null, don't leak and return proper error 2010-11-20 13:38:18 -08:00
hp_sdc.c input: Serio/hp_sdc: semaphore cleanup 2010-10-12 17:36:08 +02:00
i8042-io.h powerpc: Add i8042 keyboard and mouse irq parsing 2010-07-09 11:28:33 +10:00
i8042-ip22io.h Input: make i8042_platform_init return 'real' error code 2005-09-04 01:41:38 -05:00
i8042-jazzio.h Input: make i8042_platform_init return 'real' error code 2005-09-04 01:41:38 -05:00
i8042-ppcio.h Input: i8042 - remove SPRUCE support 2010-06-04 00:44:30 -07:00
i8042-snirm.h Input: i8042 - add SNI RM support 2008-03-14 11:54:06 -04:00
i8042-sparcio.h of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
i8042-x86ia64io.h Input: i8042 - add Sony VAIOs to MUX blacklist 2010-11-04 08:39:11 -07:00
i8042.c Merge branch 'for-linus' into next 2010-10-17 21:20:19 -07:00
i8042.h Input: i8042 - add SNI RM support 2008-03-14 11:54:06 -04:00
Kconfig Input: serio - add support for PS2Mult multiplexer protocol 2010-10-18 09:33:31 -07:00
libps2.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
maceps2.c define global BIT macro 2007-10-19 11:53:42 -07:00
Makefile Input: serio - add support for PS2Mult multiplexer protocol 2010-10-18 09:33:31 -07:00
parkbd.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
pcips2.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
ps2mult.c Input: serio - add support for PS2Mult multiplexer protocol 2010-10-18 09:33:31 -07:00
q40kbd.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
rpckbd.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sa1111ps2.c Input: sa1111ps2 - annotate probe() and remove() methods 2009-12-11 23:46:05 -08:00
serio_raw.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
serio.c Input: serio - convert to common workqueue instead of a thread 2010-11-18 00:25:45 -08:00
serport.c serport: place serport serio device correctly in the device tree 2010-10-22 10:19:58 -07:00
xilinx_ps2.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00