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

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

 



Alexey,

I have been looking through the source to look at the contexts
in which arithmetic is performed on void pointers.

  1) Are the arguments really chars of one sort or another and
therefore the parameter ought to be declared as such?
You mean, if address arithmetics is performed on a void * cast result,
check that the casted type too has sizeof 1?

I was thinking more along the lines of pointer to a character type being
converted to void * for no obvious reason, or a value being converted to
void * having an arithmetic operation performed and then converted to
a pointer to character type.
For an example see line 156 of arch/x86/kernel/module_64.c

I would expect the void * to come from/go to a type that had a
size greater than 1.

  4) Other possible fault issues, people?

I have found an instance (arch/x86/kernel/kprobes.c:834) that
effectively does:

(void *)long_val + an_int_calculation

when it should have done:

(void *)(long_val + an_int_calculation)

hardly an earth shattering misuse.

--
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