Re: [PATCH bpf v4 7/7] selftests/bpf: Test outer map update operations in syscall program

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

 



Hi,

On 12/4/2023 3:04 AM, Alexei Starovoitov wrote:
> On Thu, Nov 30, 2023 at 10:01:20PM +0800, Hou Tao wrote:
>>  
>> -	prog_load_attr.license = (long) license;
>> -	prog_load_attr.insns = (long) insns;
>> +	prog_load_attr.license = (unsigned long)license;
>> +	prog_load_attr.insns = (unsigned long)insns;
> Maybes keep it as (long) ?
> There are plenty of case where we cast a pointer to (long) because
> it's less verbose. Signedness shouldn't really matter.

It matters for 32-bits host. Because insns and license are the pointers
in kernel space, so the MSB of these pointer must be 1 under 32-bits
host. Assuming the value of license is 0xc000-0000, if using (u64)(long)
to cast the value of license, the final value will be
0xffff-ffff-c000-0000, instead of 0x0000-0000-c000-0000.

> Or use ptr_to_u64().

Will add and use ptr_to_u64() in v5. Thanks for all these suggestions.
>
> pw-bot: cr





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux