From patchwork Mon Jul 19 14:49:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 479864 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4215214jao; Mon, 19 Jul 2021 08:09:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylTn6DdUgyHBjz1DOG/JQ6LOrVOjEHKObUyRfeUekiUxxP2T7AEfdeMJjfFvse2pe5IE/x X-Received: by 2002:a05:6402:13c3:: with SMTP id a3mr34936672edx.187.1626707251327; Mon, 19 Jul 2021 08:07:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626707251; cv=none; d=google.com; s=arc-20160816; b=lIpTx64VxHGJQLjuDKQr58I83oT5PQiS6dq31LemKwlK6De+WQBmn/fzecATruJR72 BFJW1IImQovB5cQxEIHupgNuIOVbEWeUGbL4DNBkkZ9Uot5nFq6Ob55hy6N8+htYSLmq DB9lOR/5uDT1eo2DydHvnaNhRyxfiaPV1Z3VBH0a5UrAJXczrFo27UCWovH343Z+8rym puQ4UMFip8SA+EdNDZhmSkJnK83e/WxtMT5xRK7m0ajzeuwrDaTvMHeK9TCJIt9Wzprl jRuA+vYcO8OV/9Oo6NzEOje+/mqso+uw7cgoXREkgLZh9uIRnkidRWuLHNVNssCXq/8M kR5w== 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=5I8s6bO7sM/mz5VjV0Naax8pKsDYnuQwoxWZ8DPxLxI=; b=IeEfMJeOIZZNUkwGMIw8dSEW1iRubIyVgekHtArYrwgC4HHrxOxIjWiAiR9El6LtDX ZGwlu950W9vrRoPCF5odZED+Otwvz/BA6qcN2O50uU4LsX33ngQf4oQ6jJdT7y2KaG3v 8SD3sNPc/DdfWDggSHEmhQcx8GqyrNEIWBNZhEKn8VxddU55pEppSdPbFS+VaiF8z2In FTeF2RFKIgt/S3h8dKGVxt67Vggq+b7QmT+8rDnrT5Lp4Tnxp8r6+YOnRILEsm1PCyPi 3nfDxT3peFIGNL/DVYWpT88BRMXzuTrTRQBeRfYlSlN6j0f2GnPaTCl0qc+6dMycgRyO BuPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ndPb6yLN; 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 c6si19895676ejc.71.2021.07.19.08.07.31; Mon, 19 Jul 2021 08:07:31 -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=ndPb6yLN; 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 S241562AbhGSO0k (ORCPT + 12 others); Mon, 19 Jul 2021 10:26:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:38474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243175AbhGSOZc (ORCPT ); Mon, 19 Jul 2021 10:25:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7A5236113B; Mon, 19 Jul 2021 15:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626707172; bh=b4Yuh9ZXGTBdk6of/NfxeZDGAlGbAWPMhlBaB7ZNN9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndPb6yLN6PyrZaLJcwVku5J9ayYpSjQRhpMUiRrzaKduUD4g6KS0kyNHLVl27MF6Q rVUVhUg4PKE4hTJNPJTjVI9IdXSMRVaLm5ERiTYBAjzijoezjy7F3GU933ftHbUITs 0dFA0dVrLcX8qS3F8dfxXUafU+qQ4Bw7UxZgUKsg= 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 4.9 056/245] ia64: mca_drv: fix incorrect array size calculation Date: Mon, 19 Jul 2021 16:49:58 +0200 Message-Id: <20210719144942.217788233@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.288257948@linuxfoundation.org> References: <20210719144940.288257948@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 94f8bf777afa..3503d488e9b3 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];