android_kernel_motorola_sm6225/arch/powerpc/platforms
Joel Stanley ba9a32b176 powerpc/powernv: Fix sysparam sysfs error handling
When a sysparam query in OPAL returned a negative value (error code),
sysfs would spew out a decent chunk of memory; almost 64K more than
expected. This was traced to a sign/unsigned mix up in the OPAL sysparam
sysfs code at sys_param_show.

The return value of sys_param_show is a ssize_t, calculated using

  return ret ? ret : attr->param_size;

Alan Modra explains:

  "attr->param_size" is an unsigned int, "ret" an int, so the overall
  expression has type unsigned int.  Result is that ret is cast to
  unsigned int before being cast to ssize_t.

Instead of using the ternary operator, set ret to the param_size if an
error is not detected. The same bug exists in the sysfs write callback;
this patch fixes it in the same way.

A note on debugging this next time: on my system gcc will warn about
this if compiled with -Wsign-compare, which is not enabled by -Wall,
only -Wextra.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-04-28 13:08:47 +10:00
..
8xx powerpc: Remove unused REDBOOT Kconfig parameter 2013-12-30 14:17:00 +11:00
40x Removal of GENERIC_GPIO for v3.10 2013-05-09 09:59:16 -07:00
44x usb: host: remove selects of USB_ARCH_HAS_?HCI 2014-02-18 12:36:38 -08:00
52xx Merge remote-tracking branch 'agust/next' into next 2014-01-29 16:53:55 +11:00
82xx powerpc: add explicit OF includes 2013-10-09 20:04:11 -05:00
83xx powerpc: Delete non-required instances of include <linux/init.h> 2014-01-15 13:46:44 +11:00
85xx fsl/pci: The new pci suspend/resume implementation 2014-03-19 22:37:44 -05:00
86xx powerpc: add explicit OF includes 2013-10-09 20:04:11 -05:00
512x powerpc/512x: clk: support MPC5121/5123/5125 SoC variants 2014-01-12 18:59:36 +01:00
amigaone
cell arch/powerpc: Use RCU_INIT_POINTER(x, NULL) in platforms/cell/spu_syscalls.c 2014-04-09 12:53:40 +10:00
chrp powerpc: Delete non-required instances of include <linux/init.h> 2014-01-15 13:46:44 +11:00
embedded6xx powerpc/kconfig: Remove TSI108_BRIDGE duplicates 2014-03-19 16:14:44 -05:00
maple POWERPC: drivers: remove __dev* attributes. 2013-01-03 15:57:04 -08:00
pasemi powerpc: Delete non-required instances of include <linux/init.h> 2014-01-15 13:46:44 +11:00
powermac powerpc: Delete non-required instances of include <linux/init.h> 2014-01-15 13:46:44 +11:00
powernv powerpc/powernv: Fix sysparam sysfs error handling 2014-04-28 13:08:47 +10:00
ps3 Merge branch 'powernv-cpuidle' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2014-04-02 13:47:29 -07:00
pseries powerpc: Fix Oops in rtas_stop_self() 2014-04-28 13:08:47 +10:00
wsp powerpc/iommu: Add it_page_shift field to determine iommu page size 2013-12-30 14:17:13 +11:00
fsl_uli1575.c of/irq: Refactor interrupt-map parsing 2013-10-24 11:43:04 +01:00
Kconfig powerpc: Better split CONFIG_PPC_INDIRECT_PIO and CONFIG_PPC_INDIRECT_MMIO 2013-08-14 14:57:50 +10:00
Kconfig.cputype ppc: make PPC_BOOK3S_64 select IRQ_WORK 2014-04-07 16:36:09 -07:00
Makefile powerpc: Remove the main legacy iSerie platform code 2012-03-09 10:35:11 +11:00