Re: [patch 9/9] mm/vmalloc: add __alloc_size attributes for better bounds checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2021-09-10 at 10:23 -0700, Linus Torvalds wrote:
> On Thu, Sep 9, 2021 at 8:10 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > 
> > +__alloc_size(1)
> >  extern void *vmalloc(unsigned long size);
[]
> So wouldn't this all have looked much more natural as
> 
>      void *vmalloc(unsigned long size) __malloc(1);
> 
> instead? Hmm?

I think not as the __malloc attribute and in fact all the other function
attributes are effectively uninteresting when it comes to grepping for
function declarations.

Putting the attribute lists after the function arguments in many
cases would just be visual noise.

My preference would be for declarations to be mostly like:

[optional attribute list[
<return type> function(arguments);

Frequently there are multiline function declarations with many
arguments similar to either of

[optional attribute list]
<return type> function(type arg1,
		       type arg2,
		       etc...);

or

[optional attribute list]
<return type>
function(type arg1,
	 type arg2,
	 etc...);

which always makes grep rather difficult.

And given the expansion is naming lengths there are more and more
of these multiline argument lists.  It doesn't matter if the line
length is increased above 80 columns or not.






[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux