Re: [PATCH v6 11/11] arm64: annotate user pointers casts detected by sparse

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

 




On 06/09/18 21:21, Luc Van Oostenryck wrote:
> On Thu, Sep 06, 2018 at 03:13:16PM +0100, Vincenzo Frascino wrote:
>> On 05/09/18 20:03, Luc Van Oostenryck wrote:
>>> On Tue, Sep 04, 2018 at 12:27:23PM +0100, Vincenzo Frascino wrote:
>>>> ---
>>>> commit ee7985f0c2b29c96aefe78df4139209eb4e719d8
>>>> Author: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
>>>> Date:   Wed Aug 15 10:55:44 2018 +0100
>>>>
>>>>     print address space number for explicit cast to ulong
>>>>     
>>>>     This patch build on top of commit b34880d ("stricter warning
>>>>     for explicit cast to ulong") and prints the address space
>>>>     number when a "warning: cast removes address space of expression"
>>>>     is triggered.
>>>>     
>>>>     This makes easier to discriminate in between different address
>>>>     spaces.
>>>>     
>>>>     A validation example is provided as well as part of this patch.
>>>>     
>>>>     Signed-off-by: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
>>>>
>>>> diff --git a/evaluate.c b/evaluate.c
>>>> index 6d5d479..2fc0ebc 100644
>>>> --- a/evaluate.c
>>>> +++ b/evaluate.c
>>>> @@ -3017,8 +3017,12 @@ static struct symbol *evaluate_cast(struct expression *expr)
>>>>  		sas = stype->ctype.as;
>>>>  	}
>>>>  
>>>> -	if (!tas && sas > 0)
>>>> -		warning(expr->pos, "cast removes address space of expression");
>>>> +	if (!tas && sas > 0) {
>>>> +		if (Wcast_from_as)
>>>> +			warning(expr->pos, "cast removes address space of expression (<asn:%d>)", sas);
>>>> +		else
>>>> +			warning(expr->pos, "cast removes address space of expression");
>>>> +	}
>>>
>>> I think that the if (Wcast_from_as) is unneeded, the <asn:%d> can be added
>>> even if Wcast_from_as is false. Would it be OK for you?
>>>
>>
>> Yes, it is OK for me (I put it there because I did not know if we wanted to preserve the
>> original behavior). Feel free to hack my patch if you want to put it on your tree.
>> Thanks.
> 
> Yes, adding the asn is a good thing and the content of the original message
> is even not changed, just extended. I have since long the plan to associate
> a name to the address space and then to display this name when one is defined
> but this will need to wait.
> 

Agree, it is definitely more clear to grep for something like 'user' than 'asn:1'.
Please, keep me in the loop when you get there. Thanks!

> Thanks,
> -- Luc
> 

-- 
Regards,
Vincenzo



[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