smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: smatch@vger.kernel.org
Cc: Dan Carpenter <error27@gmail.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Need help with understanding format in check_unwind.c
Date: Mon, 30 Oct 2023 15:54:17 +0530	[thread overview]
Message-ID: <876265b4-e54c-40ad-b2cc-aa9ad44cf434@oracle.com> (raw)

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












             reply	other threads:[~2023-10-30 10:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 10:24 Harshit Mogalapalli [this message]
2023-10-30 10:56 ` Need help with understanding format in check_unwind.c Dan Carpenter
2023-10-30 11:04   ` Harshit Mogalapalli
2023-10-30 11:18     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=876265b4-e54c-40ad-b2cc-aa9ad44cf434@oracle.com \
    --to=harshit.m.mogalapalli@oracle.com \
    --cc=dan.carpenter@linaro.org \
    --cc=error27@gmail.com \
    --cc=smatch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).