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: <20230811121058.3918-1-e.orlova@ispras.ru>
Date:   Fri, 11 Aug 2023 15:10:58 +0300
From:   Katya Orlova <e.orlova@...ras.ru>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     Katya Orlova <e.orlova@...ras.ru>,
        David Howells <dhowells@...hat.com>,
        linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: [PATCH] ASN.1: Avoid fall-through warning

There are two FALL_THROUGH warnings in asn1_compiler.c.

The patch fixes one of them with adding 'fallthough' annotation
copied from include/linux/compiler_attributes.h.

The second one is in function render_element() in line 1487:
    case TYPE_REF:
        if (e-class == ASN1_UNIV && e->method == ASN1_prim && e->tag == 0)
            goto dont_render_tag;
    default:

Is this break omission in the else branch made on purpose or is it a
mistake?

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 4520c6a49af8 ("X.509: Add simple ASN.1 grammar compiler")
Signed-off-by: Katya Orlova <e.orlova@...ras.ru>
---
 scripts/asn1_compiler.c | 5 +++++
 1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c
index 4c3f645065a4..73e1675a852b 100644
--- a/scripts/asn1_compiler.c
+++ b/scripts/asn1_compiler.c
@@ -17,6 +17,12 @@
 #include <sys/stat.h>
 #include <linux/asn1_ber_bytecode.h>
 
+#if __has_attribute(__fallthrough__)
+# define fallthrough                __attribute__((__fallthrough__))
+#else
+# define fallthrough                do {} while (0) /* fallthrough */
+#endif

 enum token_type {
 	DIRECTIVE_ABSENT,
 	DIRECTIVE_ALL,
@@ -965,6 +971,7 @@ static struct element *parse_type(struct token **_cursor, struct token *end,
 
 	case DIRECTIVE_EXTERNAL:
 		element->method = ASN1_CONS;
+		fallthrough;
 
 	case DIRECTIVE_BMPString:
 	case DIRECTIVE_GeneralString:
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ