From nobody Thu Dec 18 19:14:10 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 612E8C83F15 for ; Wed, 30 Aug 2023 19:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238411AbjH3ToG (ORCPT ); Wed, 30 Aug 2023 15:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231509AbjH3TmD (ORCPT ); Wed, 30 Aug 2023 15:42:03 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DD8513A1 for ; Wed, 30 Aug 2023 12:13:30 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7923ae72111so4658539f.0 for ; Wed, 30 Aug 2023 12:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1693422740; x=1694027540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=c7VJ/fkol9DLzIYknMej1bs7pH/h+bM39shT1LJdITQ=; b=ITrtO32H5LYpEGeKexuY0dwRtzN8DGu1L3ANMSr3nFeKDsXDgTfNpqR8umHkQoPosu SWk03Wy4lULsmfSJg7aLBCPj4UQpIoSTHdTK8sggeuorlPzH/i5/53Wo4J6zEyUDsHO/ WABBv1bVkfOhN6yAnpW8q0osbCbFIYdary2eTcS6IClyCAEcAhU3KdA5V+0h8c+ojvds fAjlfWBOMX9eSHXVlMUv1uJdxGTalEugP0YY3PIRGXPOmET00aeVXNA9RI+MrFwpgZUE 5GddbgNMuXeizQAqaCEcGi3SD2DtXyC0V44hFqc04TnL7jN+f0SP1iuR/+3sIdZG/BmA 99uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693422740; x=1694027540; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=c7VJ/fkol9DLzIYknMej1bs7pH/h+bM39shT1LJdITQ=; b=VTWczTSfLOWyAOuH069p6fY99/kz9RZ3xGySIjjWrCtAjJg9sRLn5WwFf2KWTiKXAS YeWxqRdl8vs5Iu+ngbHVdVxHHkXRWb6ml5J3lNUM5cP7s3FBkxn3ErGtEaC8l6gZxhGR +VepZjofnpmaSnCBnx1g7MfoISp8wuNRgwH/NQ2R4WB3llgfgbYqZ87jGEVLgDtiTi2b rbFBQAFB5BdDwCagqrXcyzRDCi1iHNECXpCr2Hgo1Cgxu63kQGGf0gyKDYnEFo2ITfW0 jo3vl9UAcinXHHqZadhStAm+O7GPDUhcAurVkp4KOX+Pk/PUJhJTqhPDgXs92E0ffS01 d7Tw== X-Gm-Message-State: AOJu0YzPx+XL8gL+4qxK58e25EAV8Vz43oGhcIXxL1Db/JQt4TtjYark RhtB0eNqNlP8xKcQ+a4E3mNXag1iTXafmpb/RQg= X-Google-Smtp-Source: AGHT+IHBwJbRUA1G67hWwL5HK4wwlzT6w0g5K3CYGUziqjCrKALq7+w4aQ1uqib6vPunFEZ4/x6Asw== X-Received: by 2002:a05:6a21:3395:b0:13b:a2c9:922e with SMTP id yy21-20020a056a21339500b0013ba2c9922emr3682354pzb.27.1693421887930; Wed, 30 Aug 2023 11:58:07 -0700 (PDT) Received: from sw06.internal.sifive.com ([64.62.193.194]) by smtp.gmail.com with ESMTPSA id y11-20020a17090322cb00b001bde440e693sm11453565plg.44.2023.08.30.11.58.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 11:58:07 -0700 (PDT) From: Samuel Holland To: Evan Quan , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: Samuel Holland , Daniel Vetter , David Airlie , "Pan, Xinhui" , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/amd/pm: Replace 1-element arrays with flexible array members Date: Wed, 30 Aug 2023 11:57:32 -0700 Message-ID: <20230830185805.1126402-1-samuel.holland@sifive.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3D3"), UBSAN_BOUNDS no longer pretends 1-element arrays are unbounded. The bounds check is tripped in smu7_get_pp_table_entry_callback_func_v1(), while reading from mclk_dep_table. For consistency, fix all affected struct definitions in this file. Signed-off-by: Samuel Holland --- .../drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h b/driver= s/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h index b0ac4d121adc..fb5e935ef786 100644 --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pptable_v1_0.h @@ -164,7 +164,7 @@ typedef struct _ATOM_Tonga_State { typedef struct _ATOM_Tonga_State_Array { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_State entries[1]; /* Dynamically allocate entries. */ + ATOM_Tonga_State entries[]; /* Dynamically allocate entries. */ } ATOM_Tonga_State_Array; =20 typedef struct _ATOM_Tonga_MCLK_Dependency_Record { @@ -179,7 +179,7 @@ typedef struct _ATOM_Tonga_MCLK_Dependency_Record { typedef struct _ATOM_Tonga_MCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_MCLK_Dependency_Record entries[1]; /* Dynamically allocate = entries. */ + ATOM_Tonga_MCLK_Dependency_Record entries[]; /* Dynamically allocate e= ntries. */ } ATOM_Tonga_MCLK_Dependency_Table; =20 typedef struct _ATOM_Tonga_SCLK_Dependency_Record { @@ -194,7 +194,7 @@ typedef struct _ATOM_Tonga_SCLK_Dependency_Record { typedef struct _ATOM_Tonga_SCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate= entries. */ + ATOM_Tonga_SCLK_Dependency_Record entries[]; /* Dynamically allocate = entries. */ } ATOM_Tonga_SCLK_Dependency_Table; =20 typedef struct _ATOM_Polaris_SCLK_Dependency_Record { @@ -210,7 +210,7 @@ typedef struct _ATOM_Polaris_SCLK_Dependency_Record { typedef struct _ATOM_Polaris_SCLK_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Polaris_SCLK_Dependency_Record entries[1]; /* Dynamically alloca= te entries. */ + ATOM_Polaris_SCLK_Dependency_Record entries[]; /* Dynamically allocat= e entries. */ } ATOM_Polaris_SCLK_Dependency_Table; =20 typedef struct _ATOM_Tonga_PCIE_Record { @@ -222,7 +222,7 @@ typedef struct _ATOM_Tonga_PCIE_Record { typedef struct _ATOM_Tonga_PCIE_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_PCIE_Record entries[1]; /* Dynamically allocate entries.= */ + ATOM_Tonga_PCIE_Record entries[]; /* Dynamically allocate entries. = */ } ATOM_Tonga_PCIE_Table; =20 typedef struct _ATOM_Polaris10_PCIE_Record { @@ -235,7 +235,7 @@ typedef struct _ATOM_Polaris10_PCIE_Record { typedef struct _ATOM_Polaris10_PCIE_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of = entries. */ - ATOM_Polaris10_PCIE_Record entries[1]; /* Dynamicall= y allocate entries. */ + ATOM_Polaris10_PCIE_Record entries[]; /* Dynamicall= y allocate entries. */ } ATOM_Polaris10_PCIE_Table; =20 =20 @@ -252,7 +252,7 @@ typedef struct _ATOM_Tonga_MM_Dependency_Record { typedef struct _ATOM_Tonga_MM_Dependency_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_MM_Dependency_Record entries[1]; /* Dynamically allocate= entries. */ + ATOM_Tonga_MM_Dependency_Record entries[]; /* Dynamically allocate e= ntries. */ } ATOM_Tonga_MM_Dependency_Table; =20 typedef struct _ATOM_Tonga_Voltage_Lookup_Record { @@ -265,7 +265,7 @@ typedef struct _ATOM_Tonga_Voltage_Lookup_Record { typedef struct _ATOM_Tonga_Voltage_Lookup_Table { UCHAR ucRevId; UCHAR ucNumEntries; /* Number of entries. */ - ATOM_Tonga_Voltage_Lookup_Record entries[1]; /* Dynamically allocate e= ntries. */ + ATOM_Tonga_Voltage_Lookup_Record entries[]; /* Dynamically allocate en= tries. */ } ATOM_Tonga_Voltage_Lookup_Table; =20 typedef struct _ATOM_Tonga_Fan_Table { @@ -367,7 +367,7 @@ typedef struct _ATOM_Tonga_VCE_State_Record { typedef struct _ATOM_Tonga_VCE_State_Table { UCHAR ucRevId; UCHAR ucNumEntries; - ATOM_Tonga_VCE_State_Record entries[1]; + ATOM_Tonga_VCE_State_Record entries[]; } ATOM_Tonga_VCE_State_Table; =20 typedef struct _ATOM_Tonga_PowerTune_Table { @@ -482,7 +482,7 @@ typedef struct _ATOM_Tonga_Hard_Limit_Record { typedef struct _ATOM_Tonga_Hard_Limit_Table { UCHAR ucRevId; UCHAR ucNumEntries; - ATOM_Tonga_Hard_Limit_Record entries[1]; + ATOM_Tonga_Hard_Limit_Record entries[]; } ATOM_Tonga_Hard_Limit_Table; =20 typedef struct _ATOM_Tonga_GPIO_Table { --=20 2.41.0