From 28781d15455652e9e3c0a9417515f933c773984a Mon Sep 17 00:00:00 2001 From: Yan Burman Date: Sun, 16 Nov 2014 13:24:50 +0000 Subject: [PATCH] isert: Fix potential overrun detected by coverity Signed-off-by: Yan Burman git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/iser@5870 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/isert-scst/iser_buf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iscsi-scst/kernel/isert-scst/iser_buf.c b/iscsi-scst/kernel/isert-scst/iser_buf.c index 38783c92a..0380fae93 100644 --- a/iscsi-scst/kernel/isert-scst/iser_buf.c +++ b/iscsi-scst/kernel/isert-scst/iser_buf.c @@ -72,6 +72,7 @@ static int isert_buf_alloc_pg(struct ib_device *ib_dev, res = ib_dma_map_sg(ib_dev, isert_buf->sg, isert_buf->sg_cnt, dma_dir); if (unlikely(!res)) { + --i; /* do not overrun isert_buf->sg */ pr_err("Failed to DMA map iser sg:%p len:%d\n", isert_buf->sg, isert_buf->sg_cnt); res = -ENOMEM;