staging: zsmalloc: Ensure handle is never 0 on success
authorOlav Haugan <ohaugan@codeaurora.org>
Fri, 22 Nov 2013 17:30:41 +0000 (09:30 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2013 19:05:07 +0000 (11:05 -0800)
commit40141c33b0615e8e60173608e49762ab4944c7ac
tree2e3faf3daae3a300317ec17f7e8a85dec8f83a58
parentb8c60a6614e577e5525f6369885ab2350478ff5b
staging: zsmalloc: Ensure handle is never 0 on success

commit 67296874eb1cc80317bf2a8fba22b494e21eb29b upstream.

zsmalloc encodes a handle using the pfn and an object
index. On hardware platforms with physical memory starting
at 0x0 the pfn can be 0. This causes the encoded handle to be
0 and is incorrectly interpreted as an allocation failure.

This issue affects all current and future SoCs with physical
memory starting at 0x0. All MSM8974 SoCs which includes
Google Nexus 5 devices are affected.

To prevent this false error we ensure that the encoded handle
will not be 0 when allocation succeeds.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/zsmalloc/zsmalloc-main.c