Re: [PATCH 5/5] evaluate: stifle check if one pointer is a noderef

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

 



On Mon, Oct 29, 2018 at 03:39:52PM +0000, Ben Dooks wrote:
> If both t1 and t2 are ptr_ctype_noderef then it should be ok to ignore
> the address-space of both (in the case of passing to printf style
> functions).
> 
> Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> ---
>  evaluate.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/evaluate.c b/evaluate.c
> index 2a98a9b..0d5b8ad 100644
> --- a/evaluate.c
> +++ b/evaluate.c
> @@ -718,7 +718,8 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
>  			/* XXX: we ought to compare sizes */
>  			break;
>  		case SYM_PTR:
> -			if (as1 != as2)
> +			if (as1 != as2 && (t1 != &ptr_ctype_noderef &&
> +					   t2 != &ptr_ctype_noderef))
>  				return "different address spaces";

This can't work like you wish because no argument will ever be set
to ptr_ctype_noderef. And even if you try to it can only work for
a noderef void pointer because, for example, a noderef pointer to
an int has a type which can be described like:
	pointer(int) + noderef
while ptr_ctype_noderef is like:
	pointer(void) + noderef
Or, equivalently, the base type of 'pointer to X' is 'int' and not
'generic pointer type'. In other words, there is no links and there
can't be a link between a 'noderef pointer to type X' and
'noderef pointer to void' unless X is 'void'.

Kind regards,
-- Luc



[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