lib/scatterlist: error handling in __sg_alloc_table()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 8 Jul 2013 23:01:58 +0000 (16:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Jul 2013 17:33:31 +0000 (10:33 -0700)
commit27daabd9b6a157c34a6e7a7f509fa26866e6420f
tree349a1b1641ac497a3c999e1524dd39812f93a6b4
parenta451751172b39702e94c683882ab01d816b673c7
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.

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>
lib/scatterlist.c