[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1493105929-23353-1-git-send-email-rajnikant.bhojani@sibridgetech.com>
Date: Tue, 25 Apr 2017 13:08:49 +0530
From: Rajnikant Bhojani <rajnikant.bhojani@...ridgetech.com>
To: linux-kernel@...r.kernel.org
Subject: [PATCH] check for null while iterating over a scatterlist table
during iterating over a scatterlist table also need to check for NULL
along with number of scatterlist
Signed-off-by: Rajnikant Bhojani <rajnikant.bhojani@...ridgetech.com>
---
include/linux/scatterlist.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index cb3c8fe..f8dce12 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -146,7 +146,7 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
* Loop over each sg element, following the pointer to a new list if necessary
*/
#define for_each_sg(sglist, sg, nr, __i) \
- for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg))
+ for (__i = 0, sg = (sglist); __i < (nr) && sg; __i++, sg = sg_next(sg))
/**
* sg_chain - Chain two sglists together
--
2.7.4
Powered by blists - more mailing lists