From patchwork Thu May 11 06:06:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1779784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=B7Bz+MBX; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QH1cp5Tyvz20fn for ; Thu, 11 May 2023 16:06:50 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pwzRs-0005jK-1o; Thu, 11 May 2023 06:06:44 +0000 Received: from mail-pl1-f179.google.com ([209.85.214.179]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pwzRo-0005g9-3s for kernel-team@lists.ubuntu.com; Thu, 11 May 2023 06:06:40 +0000 Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1aad55244b7so62757205ad.2 for ; Wed, 10 May 2023 23:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683785198; x=1686377198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=VzBxr+7D0MtTLEkY+ShKotkDN7J3Jb9hQ9PcvT64Hnk=; b=B7Bz+MBXx0kyIWDSClKjwgclta+dx6EiKRSHAZ2doinPX9zzp6igBwZ96Md5trvUbp H3XO1bP8YIL+YZAwm2M8jkYGbZyS6YPVLTF1pWTs8DLJ1/EqvMFSZ/57w6j7WwuJWS54 M5lXDZXZDmhY0GgjqVuQcDLZR1UKUQmjN7Tw4eAFlcoo8lSFTGPODactPw+bHEYdUnFh qXSu+ALAQFzyG8QzLMonj4jQb2+XebdVz6EpGKdzTC6BQs7V+twpXEvFXDRC+9nfN7ca z0NCYyzMSyuO+AV0BQF/ddYf6EKA6mENnUIdvX/Zo/xLlMXqZ9J5aHzNjD+dUuZu+rZo jyHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683785198; x=1686377198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=VzBxr+7D0MtTLEkY+ShKotkDN7J3Jb9hQ9PcvT64Hnk=; b=koz2xDwySb29jmpkmTl3Ub36VzO0IB+uz377P/OVT88YSoDFghjoHoDxSEIYZdur4U 9UbYdWC+Zg7g8rh9E8nPFJgP0vfQigj5S8fARSeE+lIEyIk9N/wPuIPfc6xdu+zSTjgi SrheDKsRkMADGkmv8VsfzuXlYg4kKCz7tVhIGmrbfsHWAaG/8xzvczQKVCOfiN7v+CZZ LBhIyIWie7rCiwcl4jrBcR5zomVNIwZ5OJWEZFzv33ME9V3Q3PTIn+X32i1oIxxmN0W1 RZ84IqRibliDYL1w+/xvau2hCMn4uXThsg0xRnZ9vRJWU6qR5FBMq4OFun0LJwYqUnUB 56wg== X-Gm-Message-State: AC+VfDziMOzplCshRoqNy9OiK9J3NgNWfEJMcv8c16nBELyXLHSuMODR ZCzQiKYPTXkRFJiTh4auvG006XgIp5XHCg== X-Google-Smtp-Source: ACHHUZ44OysIeFObPMkcPJdWypFTEHz0HPJwkA9RoOc+RS/fvDbqHN8uDcxAAcWvcFSCGG2UrZQT6A== X-Received: by 2002:a17:902:f683:b0:1ac:8148:8c40 with SMTP id l3-20020a170902f68300b001ac81488c40mr16013885plg.53.1683785197892; Wed, 10 May 2023 23:06:37 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id i6-20020a170902c28600b001a52c38350fsm4888624pld.169.2023.05.10.23.06.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 23:06:37 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/6][SRU][K] scsi: megaraid_sas: Replace one-element array with flexible-array member in MR_DRV_RAID_MAP Date: Thu, 11 May 2023 14:06:25 +0800 Message-Id: <20230511060628.48935-4-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511060628.48935-1-acelan.kao@canonical.com> References: <20230511060628.48935-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.214.179; envelope-from=acelan@gmail.com; helo=mail-pl1-f179.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: "Gustavo A. R. Silva" BugLink: https://launchpad.net/bugs/2008157 One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct MR_DRV_RAID_MAP and refactor the code accordingly. This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy(). Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/109 Link: https://lore.kernel.org/r/1448f387821833726b99f0ce13069ada89164eb5.1660592640.git.gustavoars@kernel.org Reviewed-by: Kees Cook Signed-off-by: Gustavo A. R. Silva Signed-off-by: Martin K. Petersen Enhanced-by: Kees Cook # Change in struct MR_DRV_RAID_MAP_ALL (cherry picked from commit eeb3bab77244b8d91e4e9b611177cd1196900163) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/scsi/megaraid/megaraid_sas_fusion.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h index 66e13b74fcdc..df92d4369e04 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.h +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h @@ -1182,7 +1182,7 @@ struct MR_DRV_RAID_MAP { devHndlInfo[MAX_RAIDMAP_PHYSICAL_DEVICES_DYN]; u16 ldTgtIdToLd[MAX_LOGICAL_DRIVES_DYN]; struct MR_ARRAY_INFO arMapInfo[MAX_API_ARRAYS_DYN]; - struct MR_LD_SPAN_MAP ldSpanMap[1]; + struct MR_LD_SPAN_MAP ldSpanMap[]; }; @@ -1193,7 +1193,7 @@ struct MR_DRV_RAID_MAP { struct MR_DRV_RAID_MAP_ALL { struct MR_DRV_RAID_MAP raidMap; - struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_DYN - 1]; + struct MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES_DYN]; } __packed;