Skip to content

RFE: Make semcode understand function pointers #9

@jsitnicki

Description

@jsitnicki

semcode will not report any callers if a function gets called only through a function pointer:

Example:

semcode> callers tcp_v4_rcv
Finding all functions that call: tcp_v4_rcv
Info: No functions call 'tcp_v4_rcv'
semcode>

It would be awesome if semcode callers could look for any designated initializers for structures where a function is referenced, a common pattern in the kernel. Then follow up with search for any calls of the function pointer field for that structure type. It would probably result in false positives in some cases, but the user can audit the call sites manually.

In our example that is:

*** net/ipv4/af_inet.c:
inet_init[1943]                .handler = tcp_v4_rcv,

*** net/ipv4/ip_input.c:
ip_protocol_deliver_rcu[207]   ret = INDIRECT_CALL_2(ipprot->handler, tcp_v4_rcv, udp_rcv,

That would really set it apart from classic cross-referencers like cscope. I realize this is probably a hard problem or out of scope :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions