aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sparse.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-05-25 15:51:35 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-06-15 10:03:49 +0200
commitbcfe020ed939fa1e8474efaf31a86d80d0e5c5fe (patch)
treebf64a743ac1bc930757ac0198df845f544a13202 /sparse.c
parent6081052837c130ef4875a993a8034c9520e4c0ef (diff)
downloadsparse-dev-bcfe020ed939fa1e8474efaf31a86d80d0e5c5fe.tar.gz
add support for -fmemcpy-max-count
By default, sparse will warn if memcpy() (or memset(), copy_from_user(), copy_to_user()) is called with a very large static byte-count. But the limit is currently fixed at 100000, which may be fine for some uses but not for others. For example, this value is too low for sparse to be used on the git tree where, for example, some array used to sort the index is cleared with memset(). Change this by making the limit configurable via a new flag: -fmemcpy-max-count. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'sparse.c')
-rw-r--r--sparse.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sparse.c b/sparse.c
index aa5979f1..bceacd94 100644
--- a/sparse.c
+++ b/sparse.c
@@ -153,8 +153,7 @@ static void check_byte_count(struct instruction *insn, pseudo_t count)
return;
if (count->type == PSEUDO_VAL) {
unsigned long long val = count->value;
- if (Wmemcpy_max_count && val > 100000ULL)
-
+ if (Wmemcpy_max_count && val > fmemcpy_max_count)
warning(insn->pos, "%s with byte count of %llu",
show_ident(insn->func->sym->ident), val);
return;