* [PATCH] check for null while iterating over a scatterlist table
@ 2017-04-25 7:38 Rajnikant Bhojani
2017-04-25 7:42 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Rajnikant Bhojani @ 2017-04-25 7:38 UTC (permalink / raw)
To: linux-kernel
during iterating over a scatterlist table also need to check for NULL
along with number of scatterlist
Signed-off-by: Rajnikant Bhojani <rajnikant.bhojani@sibridgetech.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] check for null while iterating over a scatterlist table
@ 2017-04-25 7:39 Rajnikant Bhojani
0 siblings, 0 replies; 3+ messages in thread
From: Rajnikant Bhojani @ 2017-04-25 7:39 UTC (permalink / raw)
To: linux-kernel; +Cc: rajnikant.bhojani
during iterating over a scatterlist table also need to check for NULL
along with number of scatterlist
Signed-off-by: Rajnikant Bhojani <rajnikant.bhojani@sibridgetech.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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-25 7:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 7:38 [PATCH] check for null while iterating over a scatterlist table Rajnikant Bhojani
2017-04-25 7:42 ` Christoph Hellwig
2017-04-25 7:39 Rajnikant Bhojani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®