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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <54b7bc6c-8e30-4924-b700-bcb87b79be5a@oss.qualcomm.com>
Date: Thu, 23 Oct 2025 07:51:10 -0700
From: Jeff Johnson <jeff.johnson@....qualcomm.com>
To: linux-sparse@...r.kernel.org
Cc: linux-kernel <linux-kernel@...r.kernel.org>
Subject: Will sparse ever work correctly with guard?

In code I maintain there are places where we are now trying to use guard to
cleanup locks. But 'make W=1 C=1' is complaining:

warning: context imbalance in '<function>' - wrong count at exit

And lore shows this is not a new complaint:
[PATCH v2] parse: handle __cleanup__ attribute
https://lore.kernel.org/all/Zag2fYsyJDtDR7a6@google.com/

For some reason scoped_guard doesn't have this issue:
Re: [PATCH v1 3/3] cgroup: add lock guard support for others
https://lore.kernel.org/all/722C5824-0381-4E43-B8AE-AE8503CFF51E@gmail.com/

But using scoped_guard then requires an additional level of indentation in the
code.

So I'm wondering if there is any chance that sparse will be able to handle
guard in the same manner as scoped_guard?

The code I maintain currently has no sparse issues, so if this cannot be fixed
then I'll have to decide whether to use scoped_guard (and indent the body of
those functions) or just keep the traditional "goto cleanup" code.

/jeff

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ