Received: by 10.213.65.68 with SMTP id h4csp730168imn; Fri, 6 Apr 2018 08:00:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx48aeY1ZdUIp4wuxufJ1DdtYIaus82evO18/fyQSrZ88P9YQPrX6sFx5hIrW4wvcbjUfzcOz X-Received: by 2002:a17:902:22a:: with SMTP id 39-v6mr27960590plc.128.1523026823956; Fri, 06 Apr 2018 08:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523026823; cv=none; d=google.com; s=arc-20160816; b=0M1GdzRm0X2c7b0XVvNj7OZTylFRJuYH7TaqZxiBARNLDJenNPdKyfYlXFgJBqm9Wt KF7TwieLejV1qCIFGYecULBN2w/cK5K8gcD6KRGfiuOyA06jd0MRi79SgqQS0USYxmu2 7v0OC0CW7616NlxrKBHMUUOzwPFzoVKEF5gcD6S694sLh41iJ2pxHQrq1jug9X/mLT2w ME4bGvGcQO5gu1tYawtOykUI8FelySMkbhRB/ZFTqlkTIzUnmLUT/OYA0vns4MO00P/S eb1CmHSWbfEGKEQm3B2P9WJjWFF3eJmD8n9BthQPamJcwzhZjCqg0smw05UUyUllwlXp Aejg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qCsxP1+DSZenPwKBU3N37ufBu2DUDOv8fzMKFdqwdbQ=; b=aS0jsXqrNzoGh0yaS13eJU97fSiUi2FiTRa+XIIPDINLDaT2n0SQxP2dVoAwU0MPki 9WeqzZja3V18Ld6mcWccNDwZ0XLLWhyabJ4loDBaHpfJpHN5udiT08g1VVVOZQipTLHZ H76PI8T/s/27mVdzBw/vxkvhgRNpA9JdFbTp7BgdoV42XFXbZ6rsEmA0Ycw027tDhr2W dZoPbMV0wTWUmyayCKhw6wtX8FCEHOiknsOzIpONc/BbOSP07usDQhoc/mAPOrAH38f9 6tMVMnMAi3fL0mPhcpKVaGz6pStLre0/MR98rMb+zazEGz0nSqmE+NoleJvYQ2cTwWVj BjqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11-v6si7974972plt.472.2018.04.06.08.00.09; Fri, 06 Apr 2018 08:00:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755265AbeDFO7I (ORCPT + 99 others); Fri, 6 Apr 2018 10:59:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56454 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755117AbeDFNbU (ORCPT ); Fri, 6 Apr 2018 09:31:20 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 85923D8A; Fri, 6 Apr 2018 13:31:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Grant Grundler , Rusty Russell , Greg Hackmann , Michael Davidson , Andrew Morton , Thomas Gleixner , Nathan Chancellor Subject: [PATCH 4.4 19/72] cpumask: Add helper cpumask_available() Date: Fri, 6 Apr 2018 15:23:20 +0200 Message-Id: <20180406084306.664033652@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084305.210085169@linuxfoundation.org> References: <20180406084305.210085169@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthias Kaehlcke commit f7e30f01a9e221067bb4b579e3cfc25cd2617467 upstream. With CONFIG_CPUMASK_OFFSTACK=y cpumask_var_t is a struct cpumask pointer, otherwise a struct cpumask array with a single element. Some code dealing with cpumasks needs to validate that a cpumask_var_t is not a NULL pointer when CONFIG_CPUMASK_OFFSTACK=y. This is typically done by performing the check always, regardless of the underlying type of cpumask_var_t. This works in both cases, however clang raises a warning like this when CONFIG_CPUMASK_OFFSTACK=n: kernel/irq/manage.c:839:28: error: address of array 'desc->irq_common_data.affinity' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] Add the inline helper cpumask_available() which only performs the pointer check if CONFIG_CPUMASK_OFFSTACK=y. Signed-off-by: Matthias Kaehlcke Cc: Grant Grundler Cc: Rusty Russell Cc: Greg Hackmann Cc: Michael Davidson Cc: Andrew Morton Link: http://lkml.kernel.org/r/20170412182030.83657-1-mka@chromium.org Signed-off-by: Thomas Gleixner Cc: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- include/linux/cpumask.h | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -661,6 +661,11 @@ void alloc_bootmem_cpumask_var(cpumask_v void free_cpumask_var(cpumask_var_t mask); void free_bootmem_cpumask_var(cpumask_var_t mask); +static inline bool cpumask_available(cpumask_var_t mask) +{ + return mask != NULL; +} + #else typedef struct cpumask cpumask_var_t[1]; @@ -701,6 +706,11 @@ static inline void free_cpumask_var(cpum static inline void free_bootmem_cpumask_var(cpumask_var_t mask) { } + +static inline bool cpumask_available(cpumask_var_t mask) +{ + return true; +} #endif /* CONFIG_CPUMASK_OFFSTACK */ /* It's common to want to use cpu_all_mask in struct member initializers,