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] [day] [month] [year] [list]
Message-ID: <20260120154413.6fe90947@kernel.org>
Date: Tue, 20 Jan 2026 15:44:13 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Gal Pressman <gal@...dia.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Andrew Lunn
 <andrew+netdev@...n.ch>, <netdev@...r.kernel.org>, Simon Horman
 <horms@...nel.org>, Shuah Khan <shuah@...nel.org>, Joe Damato
 <joe@...a.to>, Stanislav Fomichev <sdf@...ichev.me>,
 <linux-kselftest@...r.kernel.org>, Nimrod Oren <noren@...dia.com>
Subject: Re: [PATCH net] selftests: net: fix wrong boolean evaluation in
 __exit__

On Tue, 20 Jan 2026 14:47:33 +0200 Gal Pressman wrote:
> The __exit__ method receives ex_type as the exception class when an
> exception occurs. The previous code used implicit boolean evaluation:
> 
>     terminate = self.terminate or (self._exit_wait and ex_type)
>                                                    ^^^^^^^^^^^
> 
> In Python, the and operator can be used with non-boolean values, but it
> does not always return a boolean result.
> 
> This is probably not what we want, because 'self._exit_wait and ex_type'
> could return the actual ex_type value (the exception class) rather than
> a boolean True when an exception occurs.
> 
> Use explicit `ex_type is not None` check to properly evaluate whether
> an exception occurred, returning a boolean result.

Sure, the checkers complain about this, but I don't see an actual bug
here. bool(terminate) must evaluate correctly, we don't compare it
to True or False explicitly.

To be clear - the patch LGTM, I'm just not connecting the dots on why
its a fix at this stage.
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ