Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp160780pxb; Wed, 25 Aug 2021 23:26:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUJ7m4QUe2qHKnKJ0a61LahRx8D1czliecUabDG/8TQ+MmkM8C9+IwStbCSqbwUUNkGy/P X-Received: by 2002:a02:c8cc:: with SMTP id q12mr2138377jao.93.1629959214370; Wed, 25 Aug 2021 23:26:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629959214; cv=none; d=google.com; s=arc-20160816; b=D4pSSEsy6GvUCkWb9OjmSvvZDz8WFAMLyfDqSwcmNoyPOJYHzn/Fu+IYViuCIIBXTj MdBYJoHH38j1yRHRe6u7c+7KUhz4tBz73PJ7B3hzxJV0Gmf36bQNMRXWj4vt8gW8mkpM kruDl33jl4ysOHc02o1Rx1bVu2S/y9nrVvx/d5MaIudhCxiI8M/+m7cDZhba7trri1s7 QZPUd1+CByFZUPWF6+pAQzpLBr6lLHqkXViNE6EfNn0wHIH0bsEd9o09Y5joccwQSL/P ussYkFDeukSFMZgmJQa2wLjSTwHgUh+0E/Yp8C/N2jDwyL8EgJAqyBdsu47xe88Sn28p NWrw== 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; bh=FCoKIoWCFUcRxCYo5KHP6WiXHioJ49Bw3nmJHtrsQGk=; b=zHF6/Onz2ovEVhoiE731qpITwrtdfmrppCPasB46jac9luv/4ouzSVuEyLuSvMmuST bgzchTPGAEL+VNqKuBjNHxSiUnpOorJ2oQKmZ3Xs3romqYPZ7oJu4VcALXGO02rMv3E5 mq//MA3bj/1ZBN67RFF70Ks/j/SUX7DarXUPL6mnkphOll9Xi4+3o1Hdhp3N3K7PNGbe mjGkxFQOJPRFYkm6A2iMbNWkpMzi/Pt9yb+nPgwsqaJ2BAHJ8mRwOhxXqvwdfqKRP3W+ C5dXal662cau07YX8hLDK+8S6OBEh+z4tqcecqEJmk0GPwW0Hf7HwSxrPgUix3+ixOnr pBug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si2090688jaj.5.2021.08.25.23.26.41; Wed, 25 Aug 2021 23:26:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239249AbhHZG1P (ORCPT + 99 others); Thu, 26 Aug 2021 02:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238082AbhHZG1P (ORCPT ); Thu, 26 Aug 2021 02:27:15 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F03C0613C1 for ; Wed, 25 Aug 2021 23:26:28 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=bjornoya.blackshift.org) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mJ8pO-0006Yt-6y; Thu, 26 Aug 2021 08:25:30 +0200 Received: from pengutronix.de (2a03-f580-87bc-d400-b2ee-1fdd-6b26-f446.ip6.dokom21.de [IPv6:2a03:f580:87bc:d400:b2ee:1fdd:6b26:f446]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id AB6A066FE3E; Thu, 26 Aug 2021 06:24:53 +0000 (UTC) Date: Thu, 26 Aug 2021 08:24:52 +0200 From: Marc Kleine-Budde To: Kees Cook Cc: linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , Arnd Bergmann , Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , Herbert Xu , "David S. Miller" , Kalle Valo , Jakub Kicinski , Stanislaw Gruszka , Luca Coelho , "James E.J. Bottomley" , "Martin K. Petersen" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Johannes Berg , Mordechay Goodstein , Lee Jones , Wolfgang Grandegger , Arunachalam Santhanam , Vincent Mailhol , Mikulas Patocka , linux-crypto@vger.kernel.org, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-scsi@vger.kernel.org, linux-can@vger.kernel.org, bpf@vger.kernel.org, Rasmus Villemoes , Keith Packard , Dan Williams , Daniel Vetter , clang-built-linux@googlegroups.com, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2 2/5] treewide: Replace open-coded flex arrays in unions Message-ID: <20210826062452.jekmoo43f4xu5jxk@pengutronix.de> References: <20210826050458.1540622-1-keescook@chromium.org> <20210826050458.1540622-3-keescook@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mnmsc5sxlpdvk3xn" Content-Disposition: inline In-Reply-To: <20210826050458.1540622-3-keescook@chromium.org> X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-crypto@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org --mnmsc5sxlpdvk3xn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 25.08.2021 22:04:55, Kees Cook wrote: > In support of enabling -Warray-bounds and -Wzero-length-bounds and > correctly handling run-time memcpy() bounds checking, replace all > open-coded flexible arrays (i.e. 0-element arrays) in unions with the > flex_array() helper macro. >=20 > This fixes warnings such as: >=20 > fs/hpfs/anode.c: In function 'hpfs_add_sector_to_btree': > fs/hpfs/anode.c:209:27: warning: array subscript 0 is outside the bounds = of an interior zero-length array 'struct bplus_internal_node[0]' [-Wzero-le= ngth-bounds] > 209 | anode->btree.u.internal[0].down =3D cpu_to_le32(a); > | ~~~~~~~~~~~~~~~~~~~~~~~^~~ > In file included from fs/hpfs/hpfs_fn.h:26, > from fs/hpfs/anode.c:10: > fs/hpfs/hpfs.h:412:32: note: while referencing 'internal' > 412 | struct bplus_internal_node internal[0]; /* (internal) 2-word = entries giving > | ^~~~~~~~ >=20 > drivers/net/can/usb/etas_es58x/es58x_fd.c: In function 'es58x_fd_tx_can_m= sg': > drivers/net/can/usb/etas_es58x/es58x_fd.c:360:35: warning: array subscrip= t 65535 is outside the bounds of an interior zero-length array 'u8[0]' {aka= 'unsigned char[]'} [-Wzero-length-bounds] > 360 | tx_can_msg =3D (typeof(tx_can_msg))&es58x_fd_urb_cmd->raw_msg[ms= g_len]; > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ > In file included from drivers/net/can/usb/etas_es58x/es58x_core.h:22, > from drivers/net/can/usb/etas_es58x/es58x_fd.c:17: > drivers/net/can/usb/etas_es58x/es58x_fd.h:231:6: note: while referencing = 'raw_msg' > 231 | u8 raw_msg[0]; > | ^~~~~~~ >=20 > Cc: "Gustavo A. R. Silva" > Cc: Arnd Bergmann > Cc: Ayush Sawal > Cc: Vinay Kumar Yadav > Cc: Rohit Maheshwari > Cc: Herbert Xu > Cc: "David S. Miller" > Cc: Kalle Valo > Cc: Jakub Kicinski > Cc: Stanislaw Gruszka > Cc: Luca Coelho > Cc: "James E.J. Bottomley" > Cc: "Martin K. Petersen" > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > Cc: Andrii Nakryiko > Cc: Martin KaFai Lau > Cc: Song Liu > Cc: Yonghong Song > Cc: John Fastabend > Cc: KP Singh > Cc: Johannes Berg > Cc: Mordechay Goodstein > Cc: Lee Jones > Cc: Wolfgang Grandegger > Cc: Marc Kleine-Budde > Cc: Arunachalam Santhanam > Cc: Vincent Mailhol > Cc: Mikulas Patocka > Cc: linux-crypto@vger.kernel.org > Cc: ath10k@lists.infradead.org > Cc: linux-wireless@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: linux-scsi@vger.kernel.org > Cc: linux-can@vger.kernel.org > Cc: bpf@vger.kernel.org > Signed-off-by: Kees Cook > --- > drivers/net/can/usb/etas_es58x/es581_4.h | 2 +- > drivers/net/can/usb/etas_es58x/es58x_fd.h | 2 +- For the can drivers: Acked-by: Marc Kleine-Budde BTW: Is there opportunity for conversion, too? | drivers/net/can/peak_canfd/peak_pciefd_main.c:146:32: warning: array of f= lexible structures regards, Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | --mnmsc5sxlpdvk3xn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEK3kIWJt9yTYMP3ehqclaivrt76kFAmEnM7EACgkQqclaivrt 76kN7Af/X372HVlb+QqkjppsRpwpNYqhBsuZx17Ly+If1NlY7bxjdbRsOVskRV0a zEmr21eyBZFMHhrQ4+CPzjkv8AMTA9dfjFViAemjlC9mP6NR63oty7R+Ae0a/pbe T0EDxGooHMTU7H702xrzo8CzTCJM01TTmriW+YM3pZC4DfhNfqYFVx6hgGrah9U5 HWD8HH3NTi9GLBk8caCqNlZVNv7lJbM7ygt5hxm2EdEy+aJGezlpS4LMpZScF9c9 p7YOev4usm+X08379kFnX7T8IympuH51b4uhaUIbsekkjACT5rJtj3cKbupp0i2X X8w2WKQ8P+u+4VA9+tgBqpt731LPIA== =1VPl -----END PGP SIGNATURE----- --mnmsc5sxlpdvk3xn--