smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Cc: smatch@vger.kernel.org, Dan Carpenter <error27@gmail.com>
Subject: Re: Need help with understanding format in check_unwind.c
Date: Mon, 30 Oct 2023 14:18:20 +0300	[thread overview]
Message-ID: <d06d35ac-1304-4b8b-b8fb-4f2ea6d2ecb6@kadam.mountain> (raw)
In-Reply-To: <468f0caa-532f-4401-88f7-eea40f8148e2@oracle.com>

On Mon, Oct 30, 2023 at 04:34:01PM +0530, Harshit Mogalapalli wrote:
> On 30/10/23 4:26 pm, Dan Carpenter wrote:
> > 
> > You're exactly right for points 1 and 2.
> > 
> > On Mon, Oct 30, 2023 at 03:54:17PM +0530, Harshit Mogalapalli wrote:
> > > 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 ?
> > > 
> > 
> > To be honest, that's probably just a mistake.  I don't know why I
> > tracked "$->start" instead of just "$".
> > 
> Oh okay,
> 1926 struct resource *request_free_mem_region(struct resource *base,
> 1927                 unsigned long size, const char *name)
> 1928 {
> 
> So this should be:
> 
> { "request_free_mem_region", ALLOC, -1 , "$", &valid_ptr_min_sval,
> &valid_ptr_max_sval}
> 
> Can you explain a bit more on why are we interested in the return value
> instead of just saying we are interested in resource here on this :
> and have third param as -1 instead of just 0(resource) ?
> 

I can't find a lot of examples of request_free_mem_region()...  I guess
I was looking at something like this:

Alloc:
sound/aoa/soundbus/i2sbus/core.c
   262                  dev->allocated_resource[i] =
   263                          request_mem_region(dev->resources[i].start,
   264                                             resource_size(&dev->resources[i]),
   265                                             dev->rnames[i]);

sound/aoa/soundbus/i2sbus/core.c
    81                  release_and_free_resource(i2sdev->allocated_resource[i]);

It's freeing -1.  That one is obvious.

Anyway, it's possible that I just got the others wrong...

regards,
dan carpenter

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

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

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=d06d35ac-1304-4b8b-b8fb-4f2ea6d2ecb6@kadam.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=error27@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.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).