*new* smatch_scripts/follow_params.pl
[smatch.git] / smatch_scripts / db / fill_db_untrusted.pl
blob871d0476829f448eb76ac08c2c2003c61a5d8365
1 #!/usr/bin/perl -w
3 use strict;
4 use DBI;
6 my $warns = shift;
8 if (!defined($warns)) {
9 print "usage: $0 <warns.txt>\n";
10 exit(1);
13 my $db = DBI->connect("dbi:SQLite:smatch_db.sqlite", "", "", {RaiseError => 1, AutoCommit => 0});
15 $db->do("delete from untrusted;");
17 open(WARNS, "<$warns");
18 while (<WARNS>) {
19 if (!($_ =~ / user_data /)) {
20 next;
22 if ($_ =~ /kfree/) {
23 next;
26 s/\n//;
28 my ($file, $dummy, $func, $param);
29 ($file, $dummy, $dummy, $dummy, $dummy, $func, $param) = split(/ /, $_);
31 if (!defined($param) || !($param =~ /^\d+$/)) {
32 next;
35 $db->do("insert into untrusted values ('$file', '$func', $param)");
37 $db->commit();
38 $db->disconnect();