On Wed, Jan 21, 2015 at 02:19:17AM +0100, Stephan Mueller wrote: > > + /* use the existing memory in an allocated page */ > + if (ctx->merge) { > + sg = sgl->sg + sgl->cur - 1; > + len = min_t(unsigned long, len, > + PAGE_SIZE - sg->offset - sg->length); > + err = memcpy_from_msg(page_address(sg_page(sg)) + > + sg->offset + sg->length, > + msg, len); > + if (err) > + goto unlock; > + > + sg->length += len; > + ctx->merge = (sg->offset + sg->length) & > + (PAGE_SIZE - 1); > + > + ctx->used += len; > + copied += len; > + size -= len; Need to add a continue here to recheck size != 0. Cheers, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html