lib/scatterlist: error handling in __sg_alloc_table()

I was reviewing code which I suspected might allocate a zero size SG
table.  That will cause memory corruption.  Also we can't return before
doing the memset or we could end up using uninitialized memory in the
cleanup path.

Change-Id: Icee6be8ea22644d7f16264d9d2a0887c7145996b
CRs-Fixed: 611562
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge "Merge "Merge "wlan: add extra debugging when DXE channel error is detected"""
Merge "Merge "Merge "ARM: dma-mapping: don't allow DMA mappings to be marked executable"""
Merge "lib/scatterlist: error handling in __sg_alloc_table()"
lib/scatterlist: error handling in __sg_alloc_table()

I was reviewing code which I suspected might allocate a zero size SG
table.  That will cause memory corruption.  Also we can't return before
doing the memset or we could end up using uninitialized memory in the
cleanup path.

Change-Id: Icee6be8ea22644d7f16264d9d2a0887c7145996b
CRs-Fixed: 611562
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge "msm: display: clear sec_active when the pipe is not for secure"
Merge "Merge "wlan: add extra debugging when DXE channel error is detected""
Merge "Merge "lib/scatterlist: error handling in __sg_alloc_table()""
Merge "Merge "Merge "wlan: add extra debugging when DXE channel error is detected"""
Merge "Merge "Merge "lib/scatterlist: error handling in __sg_alloc_table()"""
Merge "Merge "wlan: add extra debugging when DXE channel error is detected""
Merge "Merge "msm: display: clear sec_active when the pipe is not for secure""
Merge "Merge "Merge "wlan: add extra debugging when DXE channel error is detected"""
Merge "Merge "Merge "msm: display: clear sec_active when the pipe is not for secure"""
Merge "Merge "wlan: add extra debugging when DXE channel error is detected""
Merge "Merge "msm: display: clear sec_active when the pipe is not for secure""
Merge "lib/scatterlist: error handling in __sg_alloc_table()"
Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock"
Merge "Merge "Merge "wlan: add extra debugging when DXE channel error is detected"""
Merge "Merge "Merge "msm: display: clear sec_active when the pipe is not for secure"""