From 0c75bedcd05e148807e5c506d764b63bc308690b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 26 Apr 2014 01:29:22 +0300 Subject: [PATCH] unreachable: add watchdog() to kernel.no_return_funcs.remove The .remove files in the smatch_data/ directory are all sort of a hack to manually fix the other data files. In this case there are two watchdog() functions in different drives and one returns and one doesn't return. Treating them both as returning functions doesn't hurt anything but treating them as unreachable causes a false positive unreachable code warning. I had to patch up the script directory to make the .remove file work. Now all the smatch_scripts/gen_* scripts will take a -p= argument. Only the gen_no_return_funcs.sh script uses it, the rest ignore it. no_return is different because it isn't kernel specific and because it's so important. That's why it was treated differently before. Signed-off-by: Dan Carpenter --- smatch_data/kernel.no_return_funcs | 1 - smatch_data/kernel.no_return_funcs.remove | 1 + smatch_scripts/build_kernel_data.sh | 3 +-- smatch_scripts/gen_no_return_funcs.sh | 8 +++++++- 4 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 smatch_data/kernel.no_return_funcs.remove diff --git a/smatch_data/kernel.no_return_funcs b/smatch_data/kernel.no_return_funcs index 0edc84fe..c221a12f 100644 --- a/smatch_data/kernel.no_return_funcs +++ b/smatch_data/kernel.no_return_funcs @@ -98,7 +98,6 @@ usbatm_do_heavy_init vdump_bucket_and_panic wait_for_helper wait_for_panic -watchdog x86_64_start_kernel x86_64_start_reservations yield_task_stop diff --git a/smatch_data/kernel.no_return_funcs.remove b/smatch_data/kernel.no_return_funcs.remove new file mode 100644 index 00000000..e59495ee --- /dev/null +++ b/smatch_data/kernel.no_return_funcs.remove @@ -0,0 +1 @@ +watchdog diff --git a/smatch_scripts/build_kernel_data.sh b/smatch_scripts/build_kernel_data.sh index e47f2eb1..40c195ab 100755 --- a/smatch_scripts/build_kernel_data.sh +++ b/smatch_scripts/build_kernel_data.sh @@ -26,11 +26,10 @@ fi $SCRIPT_DIR/test_kernel.sh --call-tree --info --param-mapper --spammy --data=$DATA_DIR for i in $SCRIPT_DIR/gen_* ; do - $i warns.txt + $i warns.txt -p=kernel done mv ${PROJECT}.* $DATA_DIR -mv no_return_funcs $DATA_DIR/${PROJECT}.no_return_funcs $DATA_DIR/db/create_db.sh -p=kernel warns.txt diff --git a/smatch_scripts/gen_no_return_funcs.sh b/smatch_scripts/gen_no_return_funcs.sh index ab7c5e45..16e09592 100755 --- a/smatch_scripts/gen_no_return_funcs.sh +++ b/smatch_scripts/gen_no_return_funcs.sh @@ -1,13 +1,19 @@ #!/bin/bash file=$1 +project=$2 if [[ "$file" = "" ]] ; then echo "Usage: $0 " exit 1 fi -outfile="no_return_funcs" +if [[ "$project" = "-p=kernel" ]] ; then + outfile="kernel.no_return_funcs" +else + outfile="no_return_funcs" +fi + bin_dir=$(dirname $0) remove=$(echo ${bin_dir}/../smatch_data/${outfile}.remove) tmp=$(mktemp /tmp/smatch.XXXX) -- 2.11.4.GIT