Powered by Linux
How does paired function checking implement in Smatch? — Semantic Matching Tool

How does paired function checking implement in Smatch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

As you mentioned before, check_unwind.c leverages paired functions to
catch unmatch states, e.g., request_irq/free_irq, ioremap/iounmap.
Since I am not very familiar with Smatch, I have some questions about
this single check:
1. Does this check search all the paths in one function and match the
paired functions?
2. At least 14 FPs in my table are caused by the last error handling
part, e.g., drivers/net/ethernet/freescale/enetc/enetc.c:3177
enetc_pci_probe() warn: 'hw->reg' from ioremap() not released on
lines: 3177. Any idea to fix this problem?
3. I added a paired function - request_firmware vs release_firmware
with the following. Is this patch fine to check the unmatch state?

diff --git a/check_unwind.c b/check_unwind.c
index f689181b..830dcfc7 100644
--- a/check_unwind.c
+++ b/check_unwind.c
@@ -94,6 +94,9 @@ static struct ref_func_info func_table[] = {

  { "ieee80211_alloc_hw", ALLOC,  -1, "$", &valid_ptr_min_sval,
&valid_ptr_max_sval },
  { "ieee80211_free_hw",  RELEASE, 0, "$" },
+
+ { "request_firmware", ALLOC, 0, "$", &int_zero, &int_zero},
+ { "release_firmware", RELEASE, 0, "$"}
 };

 static struct smatch_state *unmatched_state(struct sm_state *sm)

--
My best regards to you.

     No System Is Safe!
     Dongliang Mu



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux