Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4404822ioa; Wed, 27 Apr 2022 03:09:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNSBvg4RyjoKfWoxxDDwxhIPF3O7NRqSlLFh4KybdiX8JVW35ZLPRvNS2mpEq1Xeiqf5O6 X-Received: by 2002:a17:902:ce01:b0:15c:eedb:f00c with SMTP id k1-20020a170902ce0100b0015ceedbf00cmr19922050plg.122.1651054183271; Wed, 27 Apr 2022 03:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651054183; cv=none; d=google.com; s=arc-20160816; b=IPECg2GBJtIzUyPQbXApMwRYGy1BIiK+BFl8/A46RgXZgm8217kqVQ2pKcBTUb2TtL jR6/qFmUtXA+fzMaXAwByPcVZqHvLJtL9CdtQjpNWCNsGOWBiGVTjgU8GbXWryHOIJVA 7gL4ksP8rZmX65eMTw1NsBpLb9fSOJyve7VgNgV4MWpmxebnBSKsWvVlgbkOaL3bm2eB JeAwIXhOIzgpGQtLF0eO+bXWF0A9NaT9/GhIyhi1/cinspaoNA0oyrm648kJLADJTOGs kBz5A3l9qS64aRUYEJqHaN8ROMcN4mH3ZsihgIPtgqBcPxUhi8klF1a3Fm5xPDWGYkss Jk+A== 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=+gaqp33POFAcjHnv84yeotYksXiv7hSnBROIXAPTvJA=; b=0rs7Pbr0vlTo/vqsCUk3xkw44QEdpU0wj7BmVTJ3SmOElD4QSrhblOvHCw8h8DydVR 5Ti8tJ2lr3ncwrBDra1H4k4FY7I25xM4tpZptSP7ivUvhbKpVi9cpEcfdrfr6FAGs4lm Bwcrj05e2vQMO5weijjLRRR/RSFGG4O/6ftYmH7jgkb1jW8xUAOGP0Gk9obwnbUDMrH6 4+Qc41rpj5JNov+wcA9lxLvy0QXlxHRpzivJq/2l18BiYLPprddA8SY0C/mfhAZ28rM/ eKj1x72nVyXIXzdv3hTmjqY3dy8a2cqhW4tmmJmXomSKcZCJnFSob7a3IF0QefJSRKSA xhEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ei7aiLsU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f4-20020a17090a700400b001c218be3cf0si1496542pjk.158.2022.04.27.03.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:09:43 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ei7aiLsU; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F23F2256A95; Wed, 27 Apr 2022 02:32:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345491AbiDZIlq (ORCPT + 99 others); Tue, 26 Apr 2022 04:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345221AbiDZIeP (ORCPT ); Tue, 26 Apr 2022 04:34:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 393397092F; Tue, 26 Apr 2022 01:26:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F329617D2; Tue, 26 Apr 2022 08:26:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9991C385A0; Tue, 26 Apr 2022 08:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650961595; bh=miV3zHvoaoWk2HMkqTcode8uSRytbQFecx1o6+yDlaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ei7aiLsU6xRgLsijBfvMwNlOd6mkQmGx57v0pxITta4/eYYr24OSu6XsUY2KwUm4I ZefqBPhaJ6z6lw7lcF+mTVKC/86QvZggUHVPnkI5H3gJQ6bj1bzgJnITtvP2i1qpSB P3clgr5eYS1NYMsHcyDEmbYlViRC+gbzyglzir+Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiongwei Song , Arthur Marsh , Andrew Morton , Linus Torvalds , Khem Raj Subject: [PATCH 4.19 02/53] mm: page_alloc: fix building error on -Werror=array-compare Date: Tue, 26 Apr 2022 10:20:42 +0200 Message-Id: <20220426081735.725489179@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081735.651926456@linuxfoundation.org> References: <20220426081735.651926456@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiongwei Song commit ca831f29f8f25c97182e726429b38c0802200c8f upstream. Arthur Marsh reported we would hit the error below when building kernel with gcc-12: CC mm/page_alloc.o mm/page_alloc.c: In function `mem_init_print_info': mm/page_alloc.c:8173:27: error: comparison between two arrays [-Werror=array-compare] 8173 | if (start <= pos && pos < end && size > adj) \ | In C++20, the comparision between arrays should be warned. Link: https://lkml.kernel.org/r/20211125130928.32465-1-sxwjean@me.com Signed-off-by: Xiongwei Song Reported-by: Arthur Marsh Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Cc: Khem Raj Signed-off-by: Greg Kroah-Hartman --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7117,7 +7117,7 @@ void __init mem_init_print_info(const ch */ #define adj_init_size(start, end, size, pos, adj) \ do { \ - if (start <= pos && pos < end && size > adj) \ + if (&start[0] <= &pos[0] && &pos[0] < &end[0] && size > adj) \ size -= adj; \ } while (0)