From patchwork Mon Jul 12 06:08:40 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: 472836 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2642493jao; Sun, 11 Jul 2021 23:21:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfwTYSViI7gRqy78WguavFo3bKSV3asRkNOr8bWQIHmL7Kr8dMplI99kDTamxumctrulCo X-Received: by 2002:a17:907:1003:: with SMTP id ox3mr8166246ejb.123.1626070881402; Sun, 11 Jul 2021 23:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626070881; cv=none; d=google.com; s=arc-20160816; b=EpOq8ccnAIMkp2uVjeGx+TrZwrVud3Y4G3Dr+l22nWmwFsL1lbhuQjiJFwwImIBPPj Ryp+IGTs4l6mXiAYWPwCxt3wtWiNTqxO/nlB3cuYOacTSrR+NSCdvV05DcudrNvWknbK fBwhfHd0sXYbVT2wPZyDO+TWUbMU6ub6DdkWZ/1bNZxk5kiL4+F9SbtJPaHC3o0G3itj Ct5zolls4rAgpg+g0tXZFDEqgdX0ESOzaJ55omPFbA/zUpA1WucuW5aqYJldFr7zuoGB +asMXZZisbD9oOMGJKZ7Jo04BebnjlbcV6YZdkiQC4O9YBPEyPpB5/mSRx9DkDBDallG lzkw== 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=XxIQI4Opt1hGe3QR3q5ARAptlQe0i7VnbVUsTsogjlA=; b=zs+ULXsAZKq1pqwdlshAM+XFnqgAKjFCUIwfUNJK2jjOMS7gygsBfe4i91rBhSw1gn iB7t4Dkn4cpVHbEofJGCfFl31sQAr+f5kO3ncL3i+r3o2E9/wWCbUYky5wlR76JNcREY +zJqkMiKBIlUieQpSwcK3dGwjOfsKRIzieQC1juZNYD+NSh0L+bJdFbTQA0Y+qEzBlme RCGgMdB6Hgje4E82Il1VnT0hJzgZ27pNQSDua5DhPcKUYidMGc1STyA8WDeSd8DdysTh VezqeQThnxcFL89fn4MRqcMvyXZOZHeT4QqWUYYnOphgX1nxWNrc0P/D831Uroq0qKt/ mzVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eWYatbBo; 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 v7si17636447edj.318.2021.07.11.23.21.21; Sun, 11 Jul 2021 23:21:21 -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=eWYatbBo; 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 S234796AbhGLGYI (ORCPT + 12 others); Mon, 12 Jul 2021 02:24:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:39276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbhGLGXA (ORCPT ); Mon, 12 Jul 2021 02:23:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B2375610CA; Mon, 12 Jul 2021 06:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626070778; bh=YmZvJ4+3XUk477qyxdL5bFEK3VrT0RD5RLuRY7lPUE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWYatbBoJS6dz5ms+vVdN4VqWB0xUcT0Fzjzz0FIFW9QVUZDu8hVzZ07WiYhI+MMc eFoXTqH4ldiNG7dWUe4xlX2vSi0fSeFzT7zgQsTmoOiURSW5A4zq+93On0B6om5NXU gHPwP+ic48elZ+Q8dRqd8Pz7nIDXk1EI8Chrl9KI= 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.4 136/348] ia64: mca_drv: fix incorrect array size calculation Date: Mon, 12 Jul 2021 08:08:40 +0200 Message-Id: <20210712060719.281272451@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@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 4d0ab323dee8..2a40268c3d49 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];