Skip to content

Commit

Permalink
ptrlist: use ptr_list_nth() instead of linearize_ptr_list()
Browse files Browse the repository at this point in the history
Sparse has a few extra checkers for some functions.
The one for memset has its own helper to 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>
  • Loading branch information
lucvoo committed Mar 6, 2021
1 parent 6bd3103 commit a69f8d7
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions sparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a69f8d7

Please sign in to comment.