Need help with understanding format in check_unwind.c

Harshit Mogalapalli <[email protected]> Mon, 30 Oct 2023 15:54:17 +0530
Newsgroups org.kernel.vger.smatch
Message-ID <[email protected]>
Hi Dan,

Can you please explain what is the notation of these table entries.

	{ "pci_request_regions", ALLOC,   0, "$", &int_zero, &int_zero },
	{ "pci_release_regions", RELEASE, 0, "$" },

	{ "request_free_mem_region", ALLOC,   -1, "$->start", 
&valid_ptr_min_sval, &valid_ptr_max_sval },
	{ "__request_region", ALLOC,   1, "$", &valid_ptr_min_sval, 
&valid_ptr_max_sval },
	{ "release_and_free_resource", RELEASE, 0, "$->start" },
	{ "release_resource", RELEASE, 0, "$->start" },
	{ "__release_region", RELEASE, 1, "$" },

	{ "ioremap", ALLOC,  -1, "$", &valid_ptr_min_sval, &valid_ptr_max_sval },
	{ "of_iomap", ALLOC,  -1, "$", &valid_ptr_min_sval, &valid_ptr_max_sval },
	{ "ioremap_encrypted", ALLOC,  -1, "$", &valid_ptr_min_sval, 
&valid_ptr_max_sval },
	{ "iounmap", RELEASE, 0, "$" },

	{ "request_threaded_irq", ALLOC,   0, "$", &int_zero, &int_zero },
	{ "request_irq", ALLOC,   0, "$", &int_zero, &int_zero },
	{ "free_irq",    RELEASE, 0, "$" },


Please correct if any of this is incorrect:

1. Second param is clear:

ALLOC is to tell that it is an allocation function
RELEASE is to tell that it is an release function.

2. Third param is the arguement number that we are interested in 
starting from 0.

2141 int request_threaded_irq(unsigned int irq, irq_handler_t handler,
2142                          irq_handler_t thread_fn, unsigned long 
irqflags,
2143                          const char *devname, void *dev_id)

We are interested in irq which is 0th param, so
{ "request_threaded_irq", ALLOC,   0, "$", &int_zero, &int_zero },

and if it is return value, then -1 ?

3. Fourth parameter:

Variable name: "$" it can be anything

Sometimes: like in:

{ "request_free_mem_region", ALLOC,   -1, "$->start", 
&valid_ptr_min_sval, &valid_ptr_max_sval}

Why did we use $->start ?

That is because the caller(dmirror_allocate_chunk()) passes start which 
is a struct member?

Can you explain a bit more on this ?

4. For ALLOC 4th and 5th params are the range of values in the success 
path ?

Can you please explain filling up these values for one or two APIs ?


Thanks,
Harshit