Subject: [merged] lib-scatterlist-error-handling-in-__sg_alloc_table.patch removed from -mm tree To: dan.carpenter@xxxxxxxxxx,akinobu.mita@xxxxxxxxx,daniel.vetter@xxxxxxxx,imre.deak@xxxxxxxxx,maximlevitsky@xxxxxxxxx,tj@xxxxxxxxxx,mm-commits@xxxxxxxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Tue, 09 Jul 2013 16:22:39 -0700 The patch titled Subject: lib/scatterlist: error handling in __sg_alloc_table() has been removed from the -mm tree. Its filename was lib-scatterlist-error-handling-in-__sg_alloc_table.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Subject: 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@xxxxxxxxxx> Cc: Akinobu Mita <akinobu.mita@xxxxxxxxx> Cc: Imre Deak <imre.deak@xxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> Cc: Maxim Levitsky <maximlevitsky@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/scatterlist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN lib/scatterlist.c~lib-scatterlist-error-handling-in-__sg_alloc_table lib/scatterlist.c --- a/lib/scatterlist.c~lib-scatterlist-error-handling-in-__sg_alloc_table +++ a/lib/scatterlist.c @@ -247,13 +247,15 @@ int __sg_alloc_table(struct sg_table *ta struct scatterlist *sg, *prv; unsigned int left; + memset(table, 0, sizeof(*table)); + + if (nents == 0) + return -EINVAL; #ifndef ARCH_HAS_SG_CHAIN if (WARN_ON_ONCE(nents > max_ents)) return -EINVAL; #endif - memset(table, 0, sizeof(*table)); - left = nents; prv = NULL; do { _ Patches currently in -mm which might be from dan.carpenter@xxxxxxxxxx are origin.patch linux-next.patch fs-convert-fs-shrinkers-to-new-scan-count-api-fix-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html