aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/scatterlist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 3675452b23ca..7874b01e816e 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -248,7 +248,8 @@ int __sg_alloc_table(struct sg_table *table, unsigned int nents,
248 unsigned int left; 248 unsigned int left;
249 249
250#ifndef ARCH_HAS_SG_CHAIN 250#ifndef ARCH_HAS_SG_CHAIN
251 BUG_ON(nents > max_ents); 251 if (WARN_ON_ONCE(nents > max_ents))
252 return -EINVAL;
252#endif 253#endif
253 254
254 memset(table, 0, sizeof(*table)); 255 memset(table, 0, sizeof(*table));