Re: [DRAFT PATCH 0/3] add support for restricted enums

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

 



On Wed, Feb 21, 2018 at 11:39:05PM +0100, Luc Van Oostenryck wrote:
> When using this series on the kernel (v4.15, defconfig) we got
> a few new sparse warning:
> 1) a problem with (fs/aio.c)
>   struct kioctx {
> 	...
>           struct __percpu kioctx_cpu *cpu;
> 	...
>   };
> 
>   should be:
> 	__percpu struct kioctx_cpu *cpu;

There's another example of this:

drivers/net/wireless/intel/iwlwifi/pcie/internal.h:     struct __percpu iwl_tso_hdr_page *tso_hdr_page;

I assume that "struct kioctx_cpu __percpu *cpu" is still acceptable?
That seems to be the majority of uses of __percpu in the kernel today.

> I can restore current behaviour of 1) but I think it should simply
> use the correct syntax. In fact I think that declaring:
> 	struct name { ... };
> and then using 'struct __some_attribute__ name' should be an error.

I think it depends on the attribute.  __bitwise is different from __percpu
here; __bitwise tells you something about the type whereas __percpu tells
you something about this particular pointer.  It's quite legitimate for
me to have a non-percpu struct kioctx_cpu, and percpu struct kioctx_cpu.
I'd say __rcu is in the same category as __percpu here.

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux