From: Rajnikant Bhojani <rajnikant.bhojani@sibridgetech.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] check for null while iterating over a scatterlist table
Date: Tue, 25 Apr 2017 13:08:49 +0530 [thread overview]
Message-ID: <1493105929-23353-1-git-send-email-rajnikant.bhojani@sibridgetech.com> (raw)
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
next reply other threads:[~2017-04-25 7:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 7:38 Rajnikant Bhojani [this message]
2017-04-25 7:42 ` Christoph Hellwig
2017-04-25 7:39 Rajnikant Bhojani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1493105929-23353-1-git-send-email-rajnikant.bhojani@sibridgetech.com \
--to=rajnikant.bhojani@sibridgetech.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®