Message ID | 20210306100552.33784-5-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | small changes to ptrlist API | expand |
On 06/03/2021 10:05, Luc Van Oostenryck wrote: > Sparse has a few extra checkers for some functions. > The one for memset has its own helper the retrieve its 3rd arguments. s/the retrieve its 3rd arguments/to retrieve its 3rd argument/ ATB, Ramsay Jones > > Remove this helper and use the generic ptr_list_nth() instead. > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> > --- > sparse.c | 13 +------------ > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/sparse.c b/sparse.c > index 151eaf4ef5ed..9d62d4fe4fc4 100644 > --- a/sparse.c > +++ b/sparse.c > @@ -163,20 +163,9 @@ static void check_byte_count(struct instruction *insn, pseudo_t count) > /* OK, we could try to do the range analysis here */ > } > > -static pseudo_t argument(struct instruction *call, unsigned int argno) > -{ > - pseudo_t args[8]; > - struct ptr_list *arg_list = (struct ptr_list *) call->arguments; > - > - argno--; > - if (linearize_ptr_list(arg_list, (void *)args, 8) > argno) > - return args[argno]; > - return NULL; > -} > - > static void check_memset(struct instruction *insn) > { > - check_byte_count(insn, argument(insn, 3)); > + check_byte_count(insn, ptr_list_nth(insn->arguments, 3)); > } > > #define check_memcpy check_memset >
diff --git a/sparse.c b/sparse.c index 151eaf4ef5ed..9d62d4fe4fc4 100644 --- a/sparse.c +++ b/sparse.c @@ -163,20 +163,9 @@ static void check_byte_count(struct instruction *insn, pseudo_t count) /* OK, we could try to do the range analysis here */ } -static pseudo_t argument(struct instruction *call, unsigned int argno) -{ - pseudo_t args[8]; - struct ptr_list *arg_list = (struct ptr_list *) call->arguments; - - argno--; - if (linearize_ptr_list(arg_list, (void *)args, 8) > argno) - return args[argno]; - return NULL; -} - static void check_memset(struct instruction *insn) { - check_byte_count(insn, argument(insn, 3)); + check_byte_count(insn, ptr_list_nth(insn->arguments, 3)); } #define check_memcpy check_memset
Sparse has a few extra checkers for some functions. The one for memset has its own helper the retrieve its 3rd arguments. Remove this helper and use the generic ptr_list_nth() instead. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- sparse.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)