From patchwork Fri Aug 11 12:10:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katya Orlova X-Patchwork-Id: 134487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1079956vqi; Fri, 11 Aug 2023 06:08:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwPmgEdSaelQLGHRAhrtCvoY83C61nZVgGQ8q5QlDuFucgc7CCFqmn3a4EmbYyDaiLJ3zS X-Received: by 2002:a05:6a20:3d90:b0:13d:1b66:9e16 with SMTP id s16-20020a056a203d9000b0013d1b669e16mr7267794pzi.10.1691759324148; Fri, 11 Aug 2023 06:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691759324; cv=none; d=google.com; s=arc-20160816; b=gGRu9Td7slatuHyvv5wgirzRkDupYEMlF/9HBiCBbdrw6zT8jJcSckcagxJYSjq3El hPeS24cG/kjmdF9AvG7YhIq4Rv58ikK+05WKLdPNE0Q7x3orrRfY1bYoLHndP3s8ZEzE SHdm/DcCAr6GIcKi7Egd7hNvL2KOsn0eu5TMUOWQoCWA9fLShWGdNqRVvEFWasCzgRFg EQ52PWaPapVdIbDZgKDkhczH9x/Gg71eSci/FCP+L2YpsJkSfi7vph1OteYXQA9mmcMT sLzWIaZPaZy5elLNAwzEBQbVdvCDwkP8Hw0mIkApJNVEGsAOAXJY74Xp1kf7cwsAgmOY VwYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=FYU5ywb+iDJpD2nOYlRwiaFT+3X+tORKUJKk3DU03Vw=; fh=zIRAwrrTz4sosCK4bz1WTK8mYHMpWNI4kFL6xBWeGu8=; b=J1KVFlEmz3YDDWSlxENPOMLkhNEGxj1VyUo2LLu8idC59poUdNRwxziRLLcr2qKL+S D/NZSeOiW8qZmwZkYtLK3UqUfBS0JQ1yZ5acoXiUt9PwjmH7qv+JLC/u27MNx/xGA/4R 10yV+ZCZuNQZvTW+Q1dqRg25hyFkeebpZQ/uJNSOJJV6+06FYxoY4e3dmhpIqzW8YTsI QN44eGRM+u4z3v09oQkuvrmRWYSiFxAszVoE4C+m2FOyvbNY6oFVEhJmE6m3NfvMvMpP YlQ+mfUv4aRlKQcFOfkZk0kgMduieEk+sUeUpqpmybSHJzP3lerDviT9jrUuC1ic9mDh SxBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=XXeonAHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a63d044000000b00563db11bacbsi3500101pgi.466.2023.08.11.06.08.31; Fri, 11 Aug 2023 06:08:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=XXeonAHo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbjHKMTt (ORCPT + 99 others); Fri, 11 Aug 2023 08:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjHKMTs (ORCPT ); Fri, 11 Aug 2023 08:19:48 -0400 X-Greylist: delayed 433 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 11 Aug 2023 05:19:29 PDT Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64803271E for ; Fri, 11 Aug 2023 05:19:29 -0700 (PDT) Received: from lvc-arm12.ispras.local (unknown [83.149.199.126]) by mail.ispras.ru (Postfix) with ESMTPSA id ECB6A40762DB; Fri, 11 Aug 2023 12:12:12 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru ECB6A40762DB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1691755933; bh=FYU5ywb+iDJpD2nOYlRwiaFT+3X+tORKUJKk3DU03Vw=; h=From:To:Cc:Subject:Date:From; b=XXeonAHoyXH483pHucKVcGbJVfeP8VBBLj/yk+XEZlNrNv+Obm0/QOksG4XZbOnZI jsW5eZoWPWhV8RbJ31uPKvPJyLftR4LrX9UaAx09Hii5gAeihMdKm4D5dJLWIk1ggw /lQHPyNFp/TJwKtAdACEy7W36tzFnQ9nL6trdBnY= From: Katya Orlova To: Masahiro Yamada Cc: Katya Orlova , David Howells , linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] ASN.1: Avoid fall-through warning Date: Fri, 11 Aug 2023 15:10:58 +0300 Message-Id: <20230811121058.3918-1-e.orlova@ispras.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773938224601514114 X-GMAIL-MSGID: 1773938224601514114 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 --- 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 #include +#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: