From patchwork Mon Jul 12 06:05:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 472946 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2672747jao; Mon, 12 Jul 2021 00:08:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUXm4XgvQuXs6t+C8c3AOug6fTj6G7WiallJxgJqAj218y58yumXlEuJFA9k5R/ZnSFEiR X-Received: by 2002:a05:6e02:1154:: with SMTP id o20mr19116489ill.168.1626073737718; Mon, 12 Jul 2021 00:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626073737; cv=none; d=google.com; s=arc-20160816; b=GprsoQ4TwD4X+P708eEbrwCr8C9RYNMJmr09tFBD7UOo14UqWoAqCS/RJVcqL3GPFE f5uBWeB+yedM0UOqFksWom7qumJvbh0fNrIr1AnKrAnDMKjyLpN+VDUssFTpahGkK59Z NSKp+SpdsfrCcpKmxc83ruCUcvEUwJTPbGHyRdAbr1VbuXPCGkKxLmSOThpmxajiDP5T o3I5hkSkILWfP/v+AQspirdVAlIwNnHj8brL0lXbsYC6xYDGxSSPWnlJrQ27uRA8cPUo UEuZo9DQ6q6qqekHQPkxmN93Ls6NMrgxohqkRH+Zb1SZzwEAbrkjkLB1KHgwasvYIuNG YK1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b2GjkFTywZIS3vKrPqxajd+KoAwiGciJ6G7MsqLSlR0=; b=lgDXtvhYA3iqcgcXUOE7vm8Ml+hFR9ys12TOyAGJtOOja0XlZLoKAPLKbU+8WICKwC bEbIatZBDkVSrOaZNcch3nz65/Lmr/z5twSBzu4iqPABtnBOHZvr5OAeAeB3YRQOvpPG Pex2OQUVhvoOqq9tE4ev4IX4LP9VMR3FCJVmjiOnkXx6uBkZxG8k82+31pvskoRxnk5T ywYUM3UAnL954l24kll8qTIFxPc7ghJTuXdesT46PIZGaN3UIDJF9J4Zz3z+qODiBAnZ gII3NtBTmvD9tH+KjWLGsAJMLoP9VNImT05rYrKYvZlodt93kUZb3GHKOiRPIYIGBjXi Gk0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r5XDfwZT; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si16580694jas.65.2021.07.12.00.08.57; Mon, 12 Jul 2021 00:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r5XDfwZT; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243958AbhGLHKE (ORCPT + 12 others); Mon, 12 Jul 2021 03:10:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:42458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242836AbhGLHG6 (ORCPT ); Mon, 12 Jul 2021 03:06:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3D3BA6113E; Mon, 12 Jul 2021 07:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626073449; bh=+V+1e3lN6okGTsu42lialwT+qtBooylVr5ZpIPrXp1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r5XDfwZTQC6G5Tfiu8pIBkDp1NSIIaXa1e6v7UjPz/Zr52W4uNZ1W7UMZ8CjwHu8u uLLtE+QYXdOE2AUFRhwWDB0ZKIyvRVqb0mLeRzZroD0JJaDEJSsUE3GzHJopN41Y48 roUAP/KvfcmQByolaeGaMEj/ZwqUEu7W52EgSkDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Masahiro Yamada , Randy Dunlap , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.12 245/700] ia64: mca_drv: fix incorrect array size calculation Date: Mon, 12 Jul 2021 08:05:28 +0200 Message-Id: <20210712061001.619721125@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit c5f320ff8a79501bb59338278336ec43acb9d7e2 ] gcc points out a mistake in the mca driver that goes back to before the git history: arch/ia64/kernel/mca_drv.c: In function 'init_record_index_pools': arch/ia64/kernel/mca_drv.c:346:54: error: expression does not compute the number of elements in this array; element typ e is 'int', not 'size_t' {aka 'long unsigned int'} [-Werror=sizeof-array-div] 346 | for (i = 1; i < sizeof sal_log_sect_min_sizes/sizeof(size_t); i++) | ^ This is the same as sizeof(size_t), which is two shorter than the actual array. Use the ARRAY_SIZE() macro to get the correct calculation instead. Link: https://lkml.kernel.org/r/20210514214123.875971-1-arnd@kernel.org Signed-off-by: Arnd Bergmann Cc: Masahiro Yamada Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- arch/ia64/kernel/mca_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.2 diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c index 36a69b4e6169..5bfc79be4cef 100644 --- a/arch/ia64/kernel/mca_drv.c +++ b/arch/ia64/kernel/mca_drv.c @@ -343,7 +343,7 @@ init_record_index_pools(void) /* - 2 - */ sect_min_size = sal_log_sect_min_sizes[0]; - for (i = 1; i < sizeof sal_log_sect_min_sizes/sizeof(size_t); i++) + for (i = 1; i < ARRAY_SIZE(sal_log_sect_min_sizes); i++) if (sect_min_size > sal_log_sect_min_sizes[i]) sect_min_size = sal_log_sect_min_sizes[i];