Re: [PATCH 7/16] Let void have sizeof 1

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

 



Christopher,

I don't see the kernel directly use sizeof(void). Most of the place is

In some places it uses sizeof(*void_ptr) and I don't think we want to
prohibit a usage that is consistent with how void_ptr can be
manipulated.

using (void*) pointer + offset. It is not portable. But it is probably not
worthy while to fix. Convert the void* to char*, add offset, convert it back
to void* is pretty annoying as well. If we really want to make it clean, maybe
we can use a macro or inline functions. Again, probably not worth the effort.

I agree.  However, we need to recognise that this hole that has been
put into the type system needs to be carefully monitored to make
sure that unintended consequences do not occur.  Hence my suggestion
that sparse check for suspicious usage, but the only one I have come
up with so far is a sequence of conversions that is equivalent to:
(char*)((void *)ch_ptr + offset)

--
Derek M. Jones                         tel: +44 (0) 1252 520 667
Knowledge Software Ltd                 mailto:derek@xxxxxxxxxxxx
Source code analysis                   http://www.knosof.co.uk
--
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