Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6353589rdb; Thu, 14 Dec 2023 16:21:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IGypvSv9ObN/6UKj8BSWef5YGOMLdnm+W9sCnMfGieJG/Cfjzsvix22yFGWgbbK7Vcs3PmF X-Received: by 2002:a0c:e649:0:b0:67a:c8bf:4e44 with SMTP id c9-20020a0ce649000000b0067ac8bf4e44mr12347841qvn.122.1702599687238; Thu, 14 Dec 2023 16:21:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702599687; cv=none; d=google.com; s=arc-20160816; b=yVg+NEf9CmIZ6g31w2gHV4c7SwxgpUUOmbJvayXTa23xw6dzjxY80euOczoZGsAyHc qLb0CJdl7ubNHjgV0P7PRlGMPZsRpTzmgnNwcgOWoG8Fgd16bzZlw7o93knnO9ZNl2U7 C+dhVmPsIaxUJOZJvbK/1nZRVy6C8u+BDS8guHJGgA3TTsgcM73a9sKZnsrES0G3VSrW UtsNAq9T9HuSh4HkftazxV6qvBRAzUGl0xEx/9qeAPj+hqamXXg1Kcc/Sj8TvTa0meaK JHGEIkpnji/rpbQjeYJuRInpta3jBKeOHJpl0YL7F6+MzduJn2Asuux9luK4XBLRzz+Q ar8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=xxhQ+xwa9s7UNFJzJpzsqjZYnGGzElD2a56jENA4R1Q=; fh=7CSJAAGZ2rTLC/UdPMGYx0nMx4VHCh2zI15XUT4GD7M=; b=uXOOusC/369BtYKODDQLL/s1cuI6O+hwq1YktUEAO1fdvUsWYiAUmsvquLi5BuPs6i fWB/xyo7PqWzmFbnKXMVkXDULlY0xe9NZeyzubJrMWZgGx5V1XsfO7wA/e3x6bseu5Zf WL9t+u+tBsZGs5W4CvENpQP/FBm+384H7es4bb0twVMySznx0+8mnmBoZBHkou/4kWWs KsJo0wYPxGtX8pC7jnHw0d8fPwLomzq/uENRTknJDE8nIFsubhiNO++dn4m76wfnl1Ba CkKY8LOs7rkSl5iDQAyoXE3foQ9Fqhyfr/1kUFCpVykcJlmyVL98Ak7zbwZcWhMKQHbL 2dCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=k66B4ZhT; spf=pass (google.com: domain of linux-kernel+bounces-283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-283-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f28-20020a0caa9c000000b0067a2145e736si1957267qvb.525.2023.12.14.16.21.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 16:21:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=k66B4ZhT; spf=pass (google.com: domain of linux-kernel+bounces-283-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-283-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 02B321C22064 for ; Fri, 15 Dec 2023 00:21:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 93814650; Fri, 15 Dec 2023 00:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="k66B4ZhT" X-Original-To: linux-kernel@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 175201C11; Fri, 15 Dec 2023 00:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=xxhQ+xwa9s7UNFJzJpzsqjZYnGGzElD2a56jENA4R1Q=; b=k66B4ZhTh66U+fvx8hZaKWswcz 4O9Ms4ph7xH+izP3b7T7TEtbmFQjxrOAAzQwQuAXceSUXHHwhNvsP8XvD+M6vBakKCPkM0+qfLysq elrHvdMXRRgAIBkCd481Acrmu0e1sPlUMIvkPN96V8xHLZ8VAkwV6TrX9OTsbU6OksrCqbBSdbHFO TDtv1u7/esxIV9lAXroaVSqB/M/5y+CHX++CVsBvlxIH1zYDvw4mQ/Az4U6LnUcbSd/R9TH37JpZ2 E7Mby4sp+13Ob8xGTwVM1EaTKbG4UWTBhZB0bZwi28Qv/ez4GMzC792/2zJMbJKvTlsPAliDznf3f 0jqSjBhg==; Received: from [50.53.46.231] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rDvx7-001cxB-1c; Fri, 15 Dec 2023 00:21:17 +0000 Message-ID: <16d1510c-fa3e-4fa9-ba4d-c483a22f83a4@infradead.org> Date: Thu, 14 Dec 2023 16:21:17 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] scripts: kernel-doc: Report excess struct member descriptions Content-Language: en-US To: Kees Cook , Jonathan Corbet Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20231215001451.work.746-kees@kernel.org> From: Randy Dunlap In-Reply-To: <20231215001451.work.746-kees@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Kees, On 12/14/23 16:14, Kees Cook wrote: > While missing descriptions were already be reported, missing struct > members were not. For example, previously this output was empty, but now > produces: > > $ ./scripts/kernel-doc -none ./drivers/leds/leds-mlxreg.c > ./drivers/leds/leds-mlxreg.c:42: warning: Excess struct member 'led_data' description in 'mlxreg_led_data' I just made a patch with similar functionality last night: https://lore.kernel.org/linux-doc/20231214070200.24405-1-rdunlap@infradead.org/ > > Cc: Jonathan Corbet > Cc: linux-doc@vger.kernel.org > Signed-off-by: Kees Cook > --- > scripts/kernel-doc | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/scripts/kernel-doc b/scripts/kernel-doc > index 08a3e603db19..39e730ee1fef 100755 > --- a/scripts/kernel-doc > +++ b/scripts/kernel-doc > @@ -1265,6 +1265,18 @@ sub dump_struct($$) { > $declaration .= "\t" . $clause . "\n"; > $level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/)); > } > + > + my %_members; > + $_members{$_}++ for (@parameterlist); > + > + while (my ($k, $v) = each %parameterdescs) { > + if (!exists($_members{$k})) { > + if (show_warnings("struct", $declaration_name)) { > + emit_warning("${file}:$.", "Excess struct member '$k' description in '$declaration_name'\n"); > + } > + } > + } > + > output_declaration($declaration_name, > 'struct', > {'struct' => $declaration_name, -- #Randy https://people.kernel.org/tglx/notes-about-netiquette https://subspace.kernel.org/etiquette.html