From patchwork Thu Jul 11 15:56:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13730827 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ABCBE16C868; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; cv=none; b=Tt9svEWJIJt8DvRH50iEO2Rxau3qQpEGyYb8YRqjr92x3Lq1Fma0+P+Se5aAakrCB5lDzAsZlztmASxBumg4S7SmGsdUzwY074G0PafOViwsMPdDDjer4jMMOS0qAHm/E9drtNZ1slpjwp06azLVf7B5rHN+MbOOCeTKALxLV9w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; c=relaxed/simple; bh=M0TaAX87c4MCbUoSFs6dg73+j59MTcKzey8Rq+WiyvA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KcrgHiK5Z7xiXlnVt0CjOZagRgt7J/jmbKO/B/FCllISxMpkezm1dfMdqKeqcvu9CZ7sE/P41lHTq8uYqrHKD/EBr92DPWqW78NNkqQWjD1WIjvaK4TzOZRlTOEtWhAVb3+W7rcPoCVWrnx0KQ3R8aySCWGYqnYeKMg7Fs3zk7M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=onY5Rxkc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="onY5Rxkc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51F13C4AF0A; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720713398; bh=M0TaAX87c4MCbUoSFs6dg73+j59MTcKzey8Rq+WiyvA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=onY5RxkciUWaPQ1zlEcEk2UYj/7PQOo2VWIVVuA616HGjjoEd2NV1g7v9WQjHSai0 Z21OD947A7p3Kv0mBK8PuGbFcAy0uTC/nrZO+lSljWeWWLLlnEXgPFTDstmO/oQp1d ws8dr7NIy56yNdcAwJ1B8pI3gzcj7OzRNwOJlQy/G1J5BmLI2i/laFk2uEpqh012mw uKCxlv/cGV5zHTi0fPa56zKr0CBAs2SiMPaI9ci5cVp3j/ogcW4JcDaUH54vUtLdkc DX45Dk/txdzbXi8f0u/RLCmMcWlU/R0nWIGBK5LEwFhGl8Q5BXW/sEDt8HoRZN1M3q HTfPSYShxw5pA== From: Kees Cook To: Sathya Prakash Veerichetty Cc: Kees Cook , Kashyap Desai , Sumit Saxena , Sreekanth Reddy , "James E.J. Bottomley" , "Martin K. Petersen" , "Gustavo A. R. Silva" , Ranjan Kumar , Stephen Rothwell , mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] scsi: mpi3mr: struct mpi3_event_data_sas_topology_change_list: Replace 1-element array with flexible array Date: Thu, 11 Jul 2024 08:56:33 -0700 Message-Id: <20240711155637.3757036-1-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240711155446.work.681-kees@kernel.org> References: <20240711155446.work.681-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2444; i=kees@kernel.org; h=from:subject; bh=M0TaAX87c4MCbUoSFs6dg73+j59MTcKzey8Rq+WiyvA=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBmkAC0gC9ATYg2hO2qEr19M3FsQgc+86AojP18P mAV5wRdhcqJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZpAAtAAKCRCJcvTf3G3A JloZD/9GJ8L0SXq31DHkhsrmpqYcNmSB2lbfugqa7XniwodAjc+qMcyEOuXSGVSTgpPyvxSNhnU tkYUeWR3RTcj9VLEyTfW3YklwkLAYbJmHkjxLSysBZI4bboOlkOo6LcKW2GNSbvqaC9i77vmjJD 6x3hgZTwytK4zvaLdIR/oxmElgBurkn1+tN0IfRCEaUhKLCrgC2MOPv8+i7MfgFIzTEr2ZIXFzw dql4OoulganUccyLpD0nDCOxsGk3jvOaWSaX+ddKcEZBiZwQcMBZUL3yFy1NmK2CerO0UypCDC1 xRxtw1jrwJao2MW1rJnWskrTenJiIuXXKz6kj7grJBWBNTH3yYn1uSVET9FkTk5CNBuYc+KOO9X YHXhBn930vYVv9Jx2of6yNuhwIORL20wlHQElw/63AEAbpEjAa3FVgkV9nCAluwUGXW7Q0JWY+c 2YnJPBpAPpPeXHVihCR0ziX1yQposA4gciNs0Ffs2S6PXHLKnY4oGtAhrRzAfhoSRAhvEHudVss ilkPfg6U0o2Q+XG9l0Wop+gjwaOcA043H6dDNAlOXeFAh9Xafx8PZdpHSUYIsPlm9sUFDuVk8aY IoO10IImrIYXHUASFYmCw7QJKF/f/oJ1SmYNmcCm+/yWjNIUiU2r7J5s01hcKgw/8RbfOOIamKe 9IpYccz++Io21sg== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Replace the deprecated[1] use of a 1-element array in struct mpi3_event_data_sas_topology_change_list with a modern flexible array. Additionally add __counted_by annotation since phy_entry is only ever accessed in loops controlled by num_entries. For example: for (i = 0; i < event_data->num_entries; i++) { ... handle = le16_to_cpu(event_data->phy_entry[i].attached_dev_handle); No binary differences are present after this conversion. Link: https://github.com/KSPP/linux/issues/79 [1] Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- Cc: Sathya Prakash Veerichetty Cc: Kashyap Desai Cc: Sumit Saxena Cc: Sreekanth Reddy Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: "Gustavo A. R. Silva" Cc: Ranjan Kumar Cc: Stephen Rothwell Cc: mpi3mr-linuxdrv.pdl@broadcom.com Cc: linux-scsi@vger.kernel.org Cc: linux-hardening@vger.kernel.org --- drivers/scsi/mpi3mr/mpi/mpi30_ioc.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h index 028784949873..ae74fccc65b8 100644 --- a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +++ b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h @@ -453,9 +453,6 @@ struct mpi3_event_data_sas_notify_primitive { #define MPI3_EVENT_NOTIFY_PRIMITIVE_POWER_LOSS_EXPECTED (0x02) #define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED1 (0x03) #define MPI3_EVENT_NOTIFY_PRIMITIVE_RESERVED2 (0x04) -#ifndef MPI3_EVENT_SAS_TOPO_PHY_COUNT -#define MPI3_EVENT_SAS_TOPO_PHY_COUNT (1) -#endif struct mpi3_event_sas_topo_phy_entry { __le16 attached_dev_handle; u8 link_rate; @@ -496,7 +493,7 @@ struct mpi3_event_data_sas_topology_change_list { u8 start_phy_num; u8 exp_status; u8 io_unit_port; - struct mpi3_event_sas_topo_phy_entry phy_entry[MPI3_EVENT_SAS_TOPO_PHY_COUNT]; + struct mpi3_event_sas_topo_phy_entry phy_entry[] __counted_by(num_entries); }; #define MPI3_EVENT_SAS_TOPO_ES_NO_EXPANDER (0x00) From patchwork Thu Jul 11 15:56:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13730826 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ABC7B16C867; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; cv=none; b=ZIx+nMuFksmpvn5DtcuQgu0dPl2Z88o/OFj6jcU+B38zVwv27LqZQHdRXsBqTn1OakO9bNKNIVrZ34oVMUUCzN5IRvZ0y+pf0eKXj+sfzuist+Oz/V7eUdHW1yYOSqOFOW1kAtXxpS3zksYibYdex30BZYxVJypHoHjRWoblbXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; c=relaxed/simple; bh=SdBmAK4WejGwirzKCX1X04soOQzEtI+n5BTeCUSwg9s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Vxk5mYjKvSYdHvgqg8En0/l73teotLNAU5Yqj9ND+MxXb82e3MhAvJ3Y4sXCbGYCMFE43PIj+Pol1YzvaU6V+z7eE+8K9O+0ucVVUgVwat93OSNmHfWP5HXOwA+5IVP/Ke5Vhk/fRdiMZ4bQ2bUwoEORHXd+7H3yePvph4VGYeY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WJCSzFNV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WJCSzFNV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D7F2C4AF09; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720713398; bh=SdBmAK4WejGwirzKCX1X04soOQzEtI+n5BTeCUSwg9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJCSzFNVhJ55+5nSyLmrtDjY+oVk/UlmeVmHMhf2W0FKD/HgQIQ8gdSL1Xn31i4De JPpw8uIbKsYuEeYDOSm2FMcSNOROX+0BrTvQ1/nqKvFi4L9AK9pI06GiHOElHrWSIX tftu9Wit07B0Kd5/dA3vKjp+TrjnQrhhCB9jYR8xOL4NJsS6MvHYPG895vKL62Gtem AGy69YdBsPEGws4EhVkAnreWhvPJ13E+d1Ptc/GMQ5XGuNQpARFmb7Q0kENsehFrEq Q4GXEqq/WsTFm9FPf6TQwn+KWKlGngtXYKqqneXUgDqcwX9N8QioNI01gq5w1/1+Ju yvIHlJyCj+trw== From: Kees Cook To: Sathya Prakash Veerichetty Cc: Kees Cook , Kashyap Desai , Sumit Saxena , Sreekanth Reddy , "James E.J. Bottomley" , "Martin K. Petersen" , "Gustavo A. R. Silva" , Ranjan Kumar , Stephen Rothwell , mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] scsi: mpi3mr: struct mpi3_event_data_pcie_topology_change_list: Replace 1-element array with flexible array Date: Thu, 11 Jul 2024 08:56:34 -0700 Message-Id: <20240711155637.3757036-2-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240711155446.work.681-kees@kernel.org> References: <20240711155446.work.681-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2512; i=kees@kernel.org; h=from:subject; bh=SdBmAK4WejGwirzKCX1X04soOQzEtI+n5BTeCUSwg9s=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBmkAC0GRmeTbFMiK4EnJ9ReQW+qUVn5p7EksGrX 9fFFpP2sEiJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZpAAtAAKCRCJcvTf3G3A Jr3ZD/9MS5VLvjrDTySiDG5PdGfa/Gu2iKahWUywl+qTltE785eeOnrWtOm0fKhqPgIxxhAgGXF llihInuUlVhH5l8d4UMVsrNabk7iSc3CCNrkgm4u4eW0m2xtrSRsJvfRoZvh7gpmyM+SGpeaAuu +PGymGgLtxEqRgOHFme+7ZNCFUkDvc4F0CcjOuPaS1yL+5QRahyzpPxbHe4P0anZmFvRCItZDO4 +h32JGXkwDA2ikqgjAMYT8u6WePlEIxFnMwQO8Rvsgu9nli9RuJVdosT79kTZr6i9t2auxSRP7h DE4DuSRY+T5V3NN30yO3JCSq5MsunFWAsgZaM1zURHgAcqQTPmBccdEnOwxvcpIzmcQSarzHkWm /plxqCU4SiRxRUX75ud4Z5DjlebFn+3YjxHVtxEkag76MHzOdObooigdTr+1kci3/gU47kcMKBH 8glhEi3LvnuvDAhV/yH52Ub14rigG8E7VqntZ51ElP01/+tTJSQTKj4+F4+a6ok5qtBIKFb1HgV OXa84h1AiBgUrkhgipQJhiNnpyYmlcso+0tmVnrZ6ne5E12qz6i0F5JlzKk6yfPp1c1vlfh5tMw CJ8P9uNkMtiOGDs9EzYqUAsoeEB8sRLfeQSPhsnQQ3Xgas6FFFyVO6d/78jGWQAWYWejjLg2LX9 F+nI//VyUrN/ajw== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Replace the deprecated[1] use of a 1-element array in struct mpi3_event_data_pcie_topology_change_list with a modern flexible array. Additionally add __counted_by annotation since port_entry is only ever accessed in loops controlled by num_entries. For example: for (i = 0; i < event_data->num_entries; i++) { handle = le16_to_cpu(event_data->port_entry[i].attached_dev_handle); No binary differences are present after this conversion. Link: https://github.com/KSPP/linux/issues/79 [1] Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- Cc: Sathya Prakash Veerichetty Cc: Kashyap Desai Cc: Sumit Saxena Cc: Sreekanth Reddy Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: "Gustavo A. R. Silva" Cc: Ranjan Kumar Cc: Stephen Rothwell Cc: mpi3mr-linuxdrv.pdl@broadcom.com Cc: linux-scsi@vger.kernel.org Cc: linux-hardening@vger.kernel.org --- drivers/scsi/mpi3mr/mpi/mpi30_ioc.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h index ae74fccc65b8..c9fa0d69b75f 100644 --- a/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +++ b/drivers/scsi/mpi3mr/mpi/mpi30_ioc.h @@ -542,9 +542,6 @@ struct mpi3_event_data_pcie_enumeration { #define MPI3_EVENT_PCIE_ENUM_ES_MAX_SWITCHES_EXCEED (0x40000000) #define MPI3_EVENT_PCIE_ENUM_ES_MAX_DEVICES_EXCEED (0x20000000) #define MPI3_EVENT_PCIE_ENUM_ES_RESOURCES_EXHAUSTED (0x10000000) -#ifndef MPI3_EVENT_PCIE_TOPO_PORT_COUNT -#define MPI3_EVENT_PCIE_TOPO_PORT_COUNT (1) -#endif struct mpi3_event_pcie_topo_port_entry { __le16 attached_dev_handle; u8 port_status; @@ -585,7 +582,7 @@ struct mpi3_event_data_pcie_topology_change_list { u8 switch_status; u8 io_unit_port; __le32 reserved0c; - struct mpi3_event_pcie_topo_port_entry port_entry[MPI3_EVENT_PCIE_TOPO_PORT_COUNT]; + struct mpi3_event_pcie_topo_port_entry port_entry[] __counted_by(num_entries); }; #define MPI3_EVENT_PCIE_TOPO_SS_NO_PCIE_SWITCH (0x00) From patchwork Thu Jul 11 15:56:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13730824 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ABBF616C859; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; cv=none; b=mthxvsEPEw2mQ2mk/Sfgg0FtQa0G4T3GEvFYl2s06LM9ky5pYtgKGzaQayyzBXFjEF3hBZlBiBz30jPWcNxERrXq7GtXDWsIK8e3sSkNARMFm8O8/AomJ6CCgYkAFLL6sVeQFncEhlGGCBQcofRYjbw/lwEYgPBzwfvLn97SvvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; c=relaxed/simple; bh=BSy2PXieeJ0tiyHG9sTrbXuGOJPeWBrgI6LboG1OoB8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bQZ+yN3OU4hO86XGvoeFWGDmV5Z8blU9/wEQY1IdkszfrGShP5dzBImXDmZydTiXqLwV5sQzsALboiMC53t7gqu4+k+7jbqtJtxAHjNoVgMfP/Tv9wV1jAaYOqLn9IhhwlBUwSoqoveZOPbMbMB8DLm165HPmSXKCMCf73QcXX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R6H0th5z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R6H0th5z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FD45C4AF0D; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720713398; bh=BSy2PXieeJ0tiyHG9sTrbXuGOJPeWBrgI6LboG1OoB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6H0th5znsNM3eiDoibOlRzFf7i4jZa5LOaTXFDRrhKzaf3UV7Qg2n8BSzr290YZF xRUAHl2ZBK3azd9rKnq8TLXUgXUQ6WjaICnmBiOwngAublcFyUM835FRFIhufrvaJW V4972q/3jQMmpeUlzhb+J1rGXzyNoSXM36XImczgISeeeSSEDL8tYzZxcapv1Baya9 rCHSdHEIFTkWBTPMGoqy6/zcI5GVJfVWKjt/DF8/xhMAFpc9kD1A9ab96L950EE9a3 fOLiqZV1/Nc7X5Sx50gkCvj9vHct3lxnfdBJ/ceMIrdtcu8BT+Q8MkUhKFPj6aOH4S bhikoNiixqrZg== From: Kees Cook To: Sathya Prakash Veerichetty Cc: Kees Cook , Kashyap Desai , Sumit Saxena , Sreekanth Reddy , "James E.J. Bottomley" , "Martin K. Petersen" , Ranjan Kumar , mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org, "Gustavo A. R. Silva" , Stephen Rothwell , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 3/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page0: Replace 1-element array with flexible array Date: Thu, 11 Jul 2024 08:56:35 -0700 Message-Id: <20240711155637.3757036-3-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240711155446.work.681-kees@kernel.org> References: <20240711155446.work.681-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1754; i=kees@kernel.org; h=from:subject; bh=BSy2PXieeJ0tiyHG9sTrbXuGOJPeWBrgI6LboG1OoB8=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBmkAC07GEwubBo8oE0yJaReSG0O8rOPQdifeArV 7lVfBpgjN+JAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZpAAtAAKCRCJcvTf3G3A JphuD/9v7SZ0Slp6GzVBDdOZASNWVWTd69JQ/QjuFGcTXJYkVqyw7EQ1LKvYFv2VNkIJ2du1e12 KiyqhDdbPsPJODnbMct4C0w3E44fCiN2P6RzRZ8HemEtW+K0HQ2R3HdxxeDOZvrCMm4om81sz0e LLmPoZVSIvij9R7xmFBx4H70pi0DLPp/YdPnxQe4V6c0R9V/HAv0VnbxDLDPd7/rzWqUJmU/Hie ojFkFDRjIEyt1l8AZ1jfFBJtl/B9eey9kOD63I9boObOzf11LJtv8v91K1MyPD5IL+eyTuLPSGN xt148FIO655ILhnBT9J0F/mtg3fyNeyLZpwKod9aCAapAO0lGNtIQm0qZLKrIbMdq2z1bv2X3TV i9yRdV9Umlqb7B3OFywPjdC75b63T63Ut4GAH4tirMfk13/nlmFW7h3vU1Rjbz5YAxvOQiQDW/v pRNK4otW/t0l1vW5JhMVl8NP8RzoG65gbuaeauP2OpfOYeIz7KoRt0H/fPUJ6ncqDWHvcav6rM8 1MRWwF/EQlo1H/CjbJ6YaH/lHI6Zogv1XdWAHUksYmm370X88QTXKOs6l1u1mLwcOebxywtrl+h ULfT+Tafp2E+OGBFLkvUOIgVmzvbWbptoCdRrKpxyJcO45W5jJWCyn9ex8nvn2n7CdNnFKHBhZM 7B1pExXM+IMCOLQ== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Replace the deprecated[1] use of a 1-element array in struct mpi3_sas_io_unit_page0 with a modern flexible array. No binary differences are present after this conversion. Link: https://github.com/KSPP/linux/issues/79 [1] Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- Cc: Sathya Prakash Veerichetty Cc: Kashyap Desai Cc: Sumit Saxena Cc: Sreekanth Reddy Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Ranjan Kumar Cc: mpi3mr-linuxdrv.pdl@broadcom.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h index 6a19e17eb1a7..66cca35d8e52 100644 --- a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +++ b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h @@ -1565,16 +1565,13 @@ struct mpi3_sas_io_unit0_phy_data { __le32 reserved10; }; -#ifndef MPI3_SAS_IO_UNIT0_PHY_MAX -#define MPI3_SAS_IO_UNIT0_PHY_MAX (1) -#endif struct mpi3_sas_io_unit_page0 { struct mpi3_config_page_header header; __le32 reserved08; u8 num_phys; u8 init_status; __le16 reserved0e; - struct mpi3_sas_io_unit0_phy_data phy_data[MPI3_SAS_IO_UNIT0_PHY_MAX]; + struct mpi3_sas_io_unit0_phy_data phy_data[]; }; #define MPI3_SASIOUNIT0_PAGEVERSION (0x00) From patchwork Thu Jul 11 15:56:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13730825 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ABC3816C862; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; cv=none; b=lBNUQl7XyivBindY3g8BfDdzqVAj3pr7aJ54Nn6bPlhs/6LKOj+WzEkvuODka6H37Z1CztG0Bo/xVQ/i6PrsGRBtxhj28Joz5x3f2YRCb168o0qfncy3sK7AESx9Lhv0GJCPhholULyIQuwOws88DUk5nuWlENaepCRDLLUKJbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720713398; c=relaxed/simple; bh=ceKGGnTAjklHaSz4gxNIGaCk5r6S+F8c24F+nByrLnE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GsvTtVfF+aeP+in+Ys4MsrZyzLvyzr6DqY1O13vygNR0GxXqULjU5cUMyVwteKzRlLVf9tZYC40ozCGxTrJQAgtivCg6/jIWPoYsFmRPr46qI6CXls4k3jtBgI/VdQ+xWv1QK2nZakcvw86lzYm7p7EV0N+w2XzwRma9msN/83o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wfp8im0T; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Wfp8im0T" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48E4DC116B1; Thu, 11 Jul 2024 15:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720713398; bh=ceKGGnTAjklHaSz4gxNIGaCk5r6S+F8c24F+nByrLnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wfp8im0T9VRl45D84VFEUVg2z5/nwHo24V8RzMbxHAW//OMcSetn9aEb26AoP8fr/ qajCrv3786itkDOauCha0EyN/tX0OjBcqzpDgcmWbkD59UkRWbZA9QWs0OlYxozq/5 moRL9RRHdGb2Crdg5KFEKPl9tbAzBji8tSW+UXYGKdqdt8Fvb/EHR5lOL753t1n+Ia BN/6q72+6Y6jOQxztr6x3ELArul/X7Qnn4kkn4EtXGAYmMmiGzuSkx6y5YMydiZKc+ zMYVW6RaWXX5+uNNPaPCzDs7cZ2vNas9UUBzxT75FcH7h3EW/XHAZwQyEkdfcZwENd kZq4WcgaSXAoA== From: Kees Cook To: Sathya Prakash Veerichetty Cc: Kees Cook , Kashyap Desai , Sumit Saxena , Sreekanth Reddy , "James E.J. Bottomley" , "Martin K. Petersen" , Ranjan Kumar , mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org, "Gustavo A. R. Silva" , Stephen Rothwell , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 4/4] scsi: mpi3mr: struct mpi3_sas_io_unit_page1: Replace 1-element array with flexible array Date: Thu, 11 Jul 2024 08:56:36 -0700 Message-Id: <20240711155637.3757036-4-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240711155446.work.681-kees@kernel.org> References: <20240711155446.work.681-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1822; i=kees@kernel.org; h=from:subject; bh=ceKGGnTAjklHaSz4gxNIGaCk5r6S+F8c24F+nByrLnE=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBmkAC02Oddyp8Zvw0b2ehDDaawKDA18u5S0Eslw mHCmnFcXyGJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZpAAtAAKCRCJcvTf3G3A JnHzD/9d7UyLj25sOOXsPkCARYfig3p2RzO61wwr9ujTHHLKO2SDfGS3zHhnQY+JdQ8qNO05Wbt 3M374yju6zCnzeLFmhKoEjJmqOxz+V4QPDBXA0od3l4W9+YTMRNRCciUbUjCDjGq7Snn6itPquT o9rXVLyBx7cHe72T2WjqeuNg7BfoZtxX4CgE+itax5z5OKr5rCeCGK35rr27UTv5hqmbwtyQJD1 DkPW2vRKQ0348BrHm/+Lh3iSmIklMFM9n+JEv1aS2XFkhCYPZ7JO/+UScjklaP+8YovxhasAp/i 7sGfL+2kZ5QJaRJm2M8iu3n60S3ZzBBg/MiIO+0yqDv9Q+sa3EYmJGYkLz/RKLqShBFa0PTqod+ mzLy2oFy3JNgDdHU36nM+682kKsS6D+5R7wDQ5GrLLskG7D80zapMKeFwaW5hdWo9Rade7iF9iZ OckAjsOGexYyYCHvlJ8zgB+PJnOcqbslGf4kgG/lYE8tLOHNXZKFqqrQDGho2XE89p6fhRWN4wv /Ki80M5Qi/dg+fKXOIWKcfilSXA8/wDuvV03UduGfW5ckOUc0PU9Wpf+I3Qc5CVvulE3FmwP5Ji b9K0gGQhXsergufZrU0ciBc1ATyFV++lFhqEreD49rv3upRY3gLTqh2m/qgLFD80VhI/+CVEg7m 52UcOasjDkS4xaw== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Replace the deprecated[1] use of a 1-element array in struct mpi3_sas_io_unit_page1 with a modern flexible array. No binary differences are present after this conversion. Link: https://github.com/KSPP/linux/issues/79 [1] Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva --- Cc: Sathya Prakash Veerichetty Cc: Kashyap Desai Cc: Sumit Saxena Cc: Sreekanth Reddy Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Ranjan Kumar Cc: mpi3mr-linuxdrv.pdl@broadcom.com Cc: linux-scsi@vger.kernel.org --- drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h index 66cca35d8e52..4b7a8f6314a3 100644 --- a/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +++ b/drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h @@ -1603,9 +1603,6 @@ struct mpi3_sas_io_unit1_phy_data { __le32 reserved08; }; -#ifndef MPI3_SAS_IO_UNIT1_PHY_MAX -#define MPI3_SAS_IO_UNIT1_PHY_MAX (1) -#endif struct mpi3_sas_io_unit_page1 { struct mpi3_config_page_header header; __le16 control_flags; @@ -1615,7 +1612,7 @@ struct mpi3_sas_io_unit_page1 { u8 num_phys; u8 sata_max_q_depth; __le16 reserved12; - struct mpi3_sas_io_unit1_phy_data phy_data[MPI3_SAS_IO_UNIT1_PHY_MAX]; + struct mpi3_sas_io_unit1_phy_data phy_data[]; }; #define MPI3_SASIOUNIT1_PAGEVERSION (0x00)