From patchwork Mon Jul 19 14:49:23 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: 479914 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4228778jao; Mon, 19 Jul 2021 08:24:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgbit6gxJt2wuCc0WHAfm/y9CFCr5y9D7ULaBgTHritN8Kp6c//X7Q/Fxq2e1SLuOplrSf X-Received: by 2002:a92:190f:: with SMTP id 15mr16644876ilz.45.1626708176324; Mon, 19 Jul 2021 08:22:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626708176; cv=none; d=google.com; s=arc-20160816; b=sQSQHn+9vGjvm6EYwXlZfLU+ZcmF3fddD2i2ZmfNa+nmvCokNEz43Rp4Z7imccS0GS iubpISbbG9JU7zA08GBlcft1Cr/b3ZhTUmOQxRdkeJCShq3luT5GeXjgkBtnu/JLEABW +xFgq9gXnjLceiKQrs5OY5uSGa9qbKcXq6kjdNdaWzCvtMAFCeuOr5FMWc/3y3OHXTey qbYwDDfvjVng3rdiZ8ElLKrDtVO8twu9HFCJew4qMkgYEz+oC4B2L2GS3L0ANLX5zSaA eV0oAV/ETbu7wotC48pjUPX2qIW45PqWkSJwXOhJG1EIfpCi4GF+saeW/Z8NVkih/bNE +gSw== 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=te4Q+bdg7cOs+McIodZoHeC1UicDrI4yG2J5fpAmrJxJE67n8HNQqNGn/zoo0KrFqe E7uFEh94pR2VIrR59Ztyih72QMEgwpLyI7c3Ul7uzNdhKalN95bymnhSaL1Q+MHM1vco hfgfzr5g2tTc+9nm2CTHxszXcCjkZIf8jNnHQf1KOC5Ixc7jYU9WV9LSrXRpXKzurMzD 1w4NGgSyzlauB1jpyiX640Nq0n6rqNH/yF+iCUpqeYa2ITpmOrcgVIDn7EyICCRewGEq tukeU5WQSaW9uFGRYwoE32A6yo6pp5J66WhDFYfyBXYlD8u2fa0goqAWQAmfObXZ64LW Bfug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wakVNW2U; 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 g15si9692004iln.71.2021.07.19.08.22.56; Mon, 19 Jul 2021 08:22:56 -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=wakVNW2U; 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 S245373AbhGSOmN (ORCPT + 12 others); Mon, 19 Jul 2021 10:42:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:55510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245574AbhGSOjS (ORCPT ); Mon, 19 Jul 2021 10:39:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A7A6860249; Mon, 19 Jul 2021 15:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626707919; bh=b4Yuh9ZXGTBdk6of/NfxeZDGAlGbAWPMhlBaB7ZNN9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wakVNW2UgdSuG+Ml91QC5NfDziwzaT/xeQnPiLzWuYcrhkIHjmGxeoPT2PwHBtahI VBjpfCQVeNTKrcHBMjJQFyJSe/v4evoHvuOJXIP2WKT2UKBoz32MdHGk474tf2wDQe yn3yOlw1g5D0dhyrBZKTiQisKbYkcZCwgAOBDKbA= 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.14 074/315] ia64: mca_drv: fix incorrect array size calculation Date: Mon, 19 Jul 2021 16:49:23 +0200 Message-Id: <20210719144945.300910321@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.861561397@linuxfoundation.org> References: <20210719144942.861561397@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];