Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1835628rdb; Tue, 3 Oct 2023 02:27:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSfWx3x5xABHHw+f9q14ve/20/iH1rg6fyiwh3JXtwF7uKkTv6MJRnt6aYIcZ6lF++GIxc X-Received: by 2002:a17:90a:b10a:b0:274:7dc2:45fa with SMTP id z10-20020a17090ab10a00b002747dc245famr11489031pjq.1.1696325228125; Tue, 03 Oct 2023 02:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696325228; cv=none; d=google.com; s=arc-20160816; b=f3qctfTUbAzd5492OqEG/2gDPgVJmVv1tg42sp1qZ2tO0AucQ1my7N5Cl9htntW+MK XeKfdsB0l9mDjAhe3YOuPyP1IhuS9eKENy+jxBGrAV6Bu5805MksO37aZX4QANe63oiu p3Mpfb3LDVbjlw+zxHydSu2C1wG9apc/wgXY+nmS32kVkaiQM1A/b8IAV9MRa0oGAjyY VzM+73fajReMoYIg9C9V3yLXVJ4nV0WiKCoue5Nipn+SsJqNi8C4jvM9c8V532vmoG7G 4lsGTsazpP5Auv1WjmvpfRt3jQ3jNAGGi9KTbcnx5dC3uGCutUS6S9jruY5GvuipFDiL /0EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=oR2Cus9Dqvx9U5F+1mIeftFSocmSFSSuTB1SHePx4x0=; fh=V+GgR1IGIoKB+ziZipAXaqRJCMaW7S3dISL7iVmdVUQ=; b=f/q9Chicv4q9BkbKyKI5ZITNi66HFp9hbOLGwW8rLP0kvTzjeObxa0i94nqcn6gJys K19JPIBfmowEyuErmOgBv18yuL7ltYG8z6fw7/MggVg2/SQpn1H08UszM0fZAL8Xfafu tS6Ki2+/qj45Q02CZHt05a+yXYbVlYNbl37ugq/UYH+8DM7XWiLHCRsdRMDi299hBqQB 5gyAavYg2ThK2VkOKnEph9oNMOZ3DlLnHpVsriB/EL+nTxZBYnChNVQLC3AX6Y60dEoN Ultnh8uvjntuGX+YzinDgXBX1S7affENHrWsGsqbzCv7p9Iun3c4urji43FGvX1L8g0l RsOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=XKjk5OQp; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a19-20020a17090a8c1300b0026829a94587si998596pjo.176.2023.10.03.02.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 02:27:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=XKjk5OQp; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7CED9803112E; Tue, 3 Oct 2023 02:27:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231228AbjJCJ0u (ORCPT + 99 others); Tue, 3 Oct 2023 05:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbjJCJ0t (ORCPT ); Tue, 3 Oct 2023 05:26:49 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9908C90; Tue, 3 Oct 2023 02:26:45 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 545BF1F38C; Tue, 3 Oct 2023 09:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1696325204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oR2Cus9Dqvx9U5F+1mIeftFSocmSFSSuTB1SHePx4x0=; b=XKjk5OQpgS6y31Rualy43b3vdr/EHVUqIrKbL4elqUv70tJEjP7JsQVDzPq24ICQWuYYiu 9DnlLOSj2Ffi+3GjHtrcv7nZa387azcLIxauv+XGGkb/WRY+sgDC8c/P7TEEkonosMIcaL AgtARRb7T3Mg/tDn3SnQUmXsl1tvTN4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1696325204; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oR2Cus9Dqvx9U5F+1mIeftFSocmSFSSuTB1SHePx4x0=; b=YR+ytWIKBOG8TlecSHsiVbP9OBvtoIomsorHVeOytFtHS2WrL+crqP6Fl9fFmZv4bs0Zb+ ARQdgJxnPWWCgxCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 40A84139F9; Tue, 3 Oct 2023 09:26:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yS7ED1TeG2UVTAAAMHmgww (envelope-from ); Tue, 03 Oct 2023 09:26:44 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id A3DFAA0830; Tue, 3 Oct 2023 11:26:43 +0200 (CEST) Date: Tue, 3 Oct 2023 11:26:43 +0200 From: Jan Kara To: "Gustavo A. R. Silva" Cc: Jan Kara , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] udf: Fix undefined behavior bug in struct udf_fileident_iter Message-ID: <20231003092643.yw5zrzthbylgy5vr@quack3> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="5qervm7vaqjfditc" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 03 Oct 2023 02:27:02 -0700 (PDT) --5qervm7vaqjfditc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon 02-10-23 18:14:26, Gustavo A. R. Silva wrote: > `struct fileIdentDesc` is a flexible structure, which means that it > contains a flexible-array member at the bottom. This could potentially > lead to an overwrite of the objects following `fi` in `struct > udf_fileident_iter` at run-time. > > Fix this by placing the declaration of object `fi` at the end of > `struct udf_fileident_iter`. > > -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > Fixes: d16076d9b684 ("udf: New directory iteration code") > Cc: stable@vger.kernel.org > Signed-off-by: Gustavo A. R. Silva Thanks for the patch! This is in fact harmless since we never use the impUse field. But I agree it is confusing so I'll merge attached fix instead. Honza -- Jan Kara SUSE Labs, CR --5qervm7vaqjfditc Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0001-udf-Avoid-unneeded-variable-length-array-in-struct-f.patch" From 7b530e7ad261dc6111874f2225c2f38f63d12ebf Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 3 Oct 2023 11:19:02 +0200 Subject: [PATCH] udf: Avoid unneeded variable length array in struct fileIdentDesc impUse variable length array in struct fileIdentDesc is never used. It serves only for documentation purposes of the on-disk format. Remove it from the struct so that it doesn't confuse the compiler and reviewers. Reported-by: "Gustavo A. R. Silva" Signed-off-by: Jan Kara --- fs/udf/ecma_167.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h index de17a97e8667..415b050b977d 100644 --- a/fs/udf/ecma_167.h +++ b/fs/udf/ecma_167.h @@ -471,7 +471,7 @@ struct fileIdentDesc { uint8_t lengthFileIdent; struct long_ad icb; __le16 lengthOfImpUse; - uint8_t impUse[]; + /* uint8_t impUse[]; */ /* uint8_t fileIdent[]; */ /* uint8_t padding[]; */ } __packed; -- 2.35.3 --5qervm7vaqjfditc--