lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54D8BFF7-C4D2-417E-B18C-62B5DB17B51B@gmail.com>
Date:   Thu, 20 Jul 2023 14:46:03 +0800
From:   Celeste Liu <coelacanthushex@...il.com>
To:     Björn Töpel <bjorn@...nel.org>,
        Andreas Schwab <schwab@...e.de>
CC:     Palmer Dabbelt <palmer@...osinc.com>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Albert Ou <aou@...s.berkeley.edu>, Guo Ren <guoren@...nel.org>,
        Björn Töpel <bjorn@...osinc.com>,
        Conor Dooley <conor.dooley@...rochip.com>,
        linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Felix Yan <felixonmars@...hlinux.org>,
        Ruizhe Pan <c141028@...il.com>,
        Shiqi Zhang <shiqi@...c.iscas.ac.cn>
Subject: Re: [PATCH v3] riscv: entry: set a0 = -ENOSYS only when syscall != -1

On July 20, 2023 12:28:47 AM GMT+08:00, "Björn Töpel" <bjorn@...nel.org> wrote:
>Andreas Schwab <schwab@...e.de> writes:
>
>> On Jul 19 2023, Celeste Liu wrote:
>>
>>> @@ -308,7 +312,7 @@ asmlinkage __visible __trap_section void do_trap_ecall_u(struct pt_regs *regs)
>>>  
>>>  		if (syscall < NR_syscalls)
>>>  			syscall_handler(regs, syscall);
>>> -		else
>>> +		else if ((long)syscall != -1L)
>>
>> You can also use syscall != -1UL or even syscall != -1.
>
>The former is indeed better for the eyes! :-) The latter will get a
>-Wsign-compare warning, no?
>
>
>Björn

Well, that's true. And I just found out that by C standards, converting
ulong to long is implementation-defined behavior, unlike long to ulong
which is well-defined. So it is really better than (long)syscall != -1L.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ