]> Pileus Git - ~andy/linux/blobdiff - lib/scatterlist.c
tuntap: forbid calling TUNSETIFF when detached
[~andy/linux] / lib / scatterlist.c
index 3675452b23ca175b612489e362aa7274b75d96a5..7874b01e816e815466ccee3a08387b075503c72f 100644 (file)
@@ -248,7 +248,8 @@ int __sg_alloc_table(struct sg_table *table, unsigned int nents,
        unsigned int left;
 
 #ifndef ARCH_HAS_SG_CHAIN
-       BUG_ON(nents > max_ents);
+       if (WARN_ON_ONCE(nents > max_ents))
+               return -EINVAL;
 #endif
 
        memset(table, 0, sizeof(*table));