Re: Need help with understanding format in check_unwind.c
Dan Carpenter <[email protected]> Mon, 30 Oct 2023 14:18:20 +0300
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <[email protected]> |
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