Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2605055rwd; Fri, 2 Jun 2023 11:45:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ51lMK9UpihpMwRAxzGy7TObhMuNZPCkSOvtbSxfFM0MbalwI8dWk5/9sRk8Tar7ZDu1fXg X-Received: by 2002:a17:902:d506:b0:1b0:e0a:b7ab with SMTP id b6-20020a170902d50600b001b00e0ab7abmr751252plg.31.1685731500489; Fri, 02 Jun 2023 11:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685731500; cv=none; d=google.com; s=arc-20160816; b=HArpYy+xKDycZxd002IKOdMUhhkaJ37PGwaMLSNAj4OejEitFzzrebB+gyUGWe8xE1 nCUM4tFxz9nNeN/vSQV8MZKfSVA1VLbnM83q7SjFdF1kWBH0ih3NlakbLI1Ahbnf1519 9N2xtQQz0YR+/ntsF9FM/NaZ4P6l74VlSa9JF8X0AN75zChZeXDljiSdIXxvLRxsbsxR 2RLiNa3q6vUL1b5p+ZfogV5dnZjVEJrA+YqiqXQQ3CU/ZzVnQj/g1Y502UL0bA7cBQwW lr1j5gx2G6hycreJaopURjyyKo7nNSYe8jCPlQ7IPA3qeI7Dq1zIPN2FxHiUYDlboikO bEsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=pCpdjBkJUYgIy9lNltbYiGa3ZgStuC7RDZQxLOMxnlo=; b=c2FvGi2a4Wd/g3BmDOQtmCK0BZnDEqYXlQuveD4ImFWS5IQP4lNrsX4S9LHRgbnxsC Kd1xpQP3xfjsfVpMQfFe5wPqN932RQ4rkNYgguwQyo5SC573wWnATMUDoZiNWDxqz959 WnRHFoQ+BWy4PY1+6XvPV5htmIcaSeJyQ5aQsGGTVEtKblxnQY6Jy6yHtVivZlWd8bWE Us2sVW6VEqgnDQCTEqHMpfbiKMvE0iPQHJXikqhvY1ovk8ucFxbPpltNv27ic5nh8oIo 2x82jXoz7py67CsAoSb4rNpXX6Kdqs0A6d2VQz74V5vQp7R7hRMV0PSq0iIeooSUXLyC WuaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Il2Q5vnE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a170902d34d00b001ae4f2b8cfdsi1189441plk.633.2023.06.02.11.44.45; Fri, 02 Jun 2023 11:45:00 -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=@gmail.com header.s=20221208 header.b=Il2Q5vnE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236365AbjFBS2E (ORCPT + 99 others); Fri, 2 Jun 2023 14:28:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235788AbjFBS2C (ORCPT ); Fri, 2 Jun 2023 14:28:02 -0400 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 280A0E4C; Fri, 2 Jun 2023 11:27:39 -0700 (PDT) Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-39817f3e08eso1617303b6e.1; Fri, 02 Jun 2023 11:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685730458; x=1688322458; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pCpdjBkJUYgIy9lNltbYiGa3ZgStuC7RDZQxLOMxnlo=; b=Il2Q5vnEuOsVPn39znvA45ROyAzkapbksPf6Y4YCIcrxkofev6N1e6Esex7ub+8eHC 4Q0PKtXWaY7Ui4KlAWPrBoqDO7G1JxOHAy3ZiL7nnVsCXVhl5rZ532vtPGvhy7bInST5 dOupD8gMSF4cQ9CHL0PjeONm2DStZANIIQ/HxinhYDm55+dkSOfcGQPnQz4KjeKIDNPK cgQhkqJJxnKXoYHtsPH8ya1QT2Cw+Ifer9AaLesI99NWxiXxNyUKwKab2E8b+VNInVKQ Z2HHaXXWnyMk65a132dg0Pb5VL67/kjXvsNz859c/xrAxlIjgOFj5rP4f+C5B4r+Ovij ta6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685730458; x=1688322458; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pCpdjBkJUYgIy9lNltbYiGa3ZgStuC7RDZQxLOMxnlo=; b=MMMIRLoEhWGsG9QJuViKyCfandCNXbZWfPeZZgpYLYsELP5Ffq6n8kfuOLysngQlV2 3rh3V79eaCuqU8BXlgrao+h+4/e754v2Mlv+kWOhkM/umQfIXBzIbobQfja8KZNzORJ2 dPnbkJIyIGoU6eJcqcLt/V/0qxR6A/Wp2AcvijKkbXQMpgt2Fh8sEFHFmB7Q73BfG8fk mF0NTDCZBL5oQqB0FqEPmOfSdirxl0UpC0an9uuwbB24DBhiJi7bVuvGrN/0LDNH1G+E YS0rD6b+dJbFkk0nfc/ql/jiM7Tr4wbRvCPfF/oEJ0tkaqeyMhpdodP42S/Q1keNuSV1 Gyjg== X-Gm-Message-State: AC+VfDz4aPxC1bmQc5F6GK4SL93MPIxb1ju/fs6T0BAbVt24bhYQDI4k aIHU7ahq5PeP5Di54Rjhzgwo/5wEoSbIS9H+p5LRxraL X-Received: by 2002:a05:6808:15:b0:389:4f7b:949d with SMTP id u21-20020a056808001500b003894f7b949dmr707601oic.22.1685730458405; Fri, 02 Jun 2023 11:27:38 -0700 (PDT) MIME-Version: 1.0 References: <202305301608.2982BD3CAF@keescook> In-Reply-To: <202305301608.2982BD3CAF@keescook> From: Alex Deucher Date: Fri, 2 Jun 2023 14:27:27 -0400 Message-ID: Subject: Re: [PATCH][next] drm/amdgpu/discovery: Replace fake flex-arrays with flexible-array members To: Kees Cook Cc: "Gustavo A. R. Silva" , "Pan, Xinhui" , linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, 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 Applied. Thanks! On Tue, May 30, 2023 at 7:08=E2=80=AFPM Kees Cook w= rote: > > On Sun, May 28, 2023 at 02:26:37PM -0600, Gustavo A. R. Silva wrote: > > Zero-length and one-element arrays are deprecated, and we are moving > > towards adopting C99 flexible-array members, instead. > > > > Use the DECLARE_FLEX_ARRAY() helper macro to transform zero-length > > arrays in a union into flexible-array members. And replace a one-elemen= t > > array with a C99 flexible-array member. > > > > Address the following warnings found with GCC-13 and > > -fstrict-flex-arrays=3D3 enabled: > > drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1009:89: warning: array s= ubscript kk is outside array bounds of =E2=80=98uint32_t[0]=E2=80=99 {aka = =E2=80=98unsigned int[]=E2=80=99} [-Warray-bounds=3D] > > drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1007:94: warning: array s= ubscript kk is outside array bounds of =E2=80=98uint64_t[0]=E2=80=99 {aka = =E2=80=98long long unsigned int[]=E2=80=99} [-Warray-bounds=3D] > > drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1310:94: warning: array s= ubscript k is outside array bounds of =E2=80=98uint64_t[0]=E2=80=99 {aka = =E2=80=98long long unsigned int[]=E2=80=99} [-Warray-bounds=3D] > > drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c:1309:57: warning: array s= ubscript k is outside array bounds of =E2=80=98uint32_t[0]=E2=80=99 {aka = =E2=80=98unsigned int[]=E2=80=99} [-Warray-bounds=3D] > > > > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE > > routines on memcpy() and help us make progress towards globally > > enabling -fstrict-flex-arrays=3D3 [1]. > > > > This results in no differences in binary output. > > > > Link: https://github.com/KSPP/linux/issues/21 > > Link: https://github.com/KSPP/linux/issues/193 > > Link: https://github.com/KSPP/linux/issues/300 > > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.htm= l [1] > > Signed-off-by: Gustavo A. R. Silva > > Reviewed-by: Kees Cook > > -- > Kees Cook