https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80378

            Bug ID: 80378
           Summary: Extend alloc_size attribute for better Linux kernel
                    checking
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andi-gcc at firstfloor dot org
  Target Milestone: ---

I've been adding alloc_size attributes to the Linux kernel allocators.

However there are some allocator patterns that can currently not be correctly
described. It would be nice if the attribute could be extended with more
parameters to handle this.

One is 

void *alloc(int size_a, int size_b)

where the allocation size is size_a + size_b

The other is

void *alloc_order(int order)

where the allocation size is constant << order

This could be handled by two extra parameters to alloc_size, one to give a sum
argument and another to to give a shifted by argument. The arguments 2,3 would
also need to support a "ignore" parameter (e.g. -1)

Reply via email to