Received: by 10.213.65.68 with SMTP id h4csp721484imn; Fri, 6 Apr 2018 07:51:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx49dGRiFsTCGqWYj98IMSOrwoN0aAGKXBRaFj7OB0b701BD/nrclBL5hLPES0JdXSq6rG/P9 X-Received: by 2002:a17:902:9696:: with SMTP id n22-v6mr28411246plp.355.1523026272225; Fri, 06 Apr 2018 07:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523026272; cv=none; d=google.com; s=arc-20160816; b=W8FhX9InrpE8uD+cKmLvX6YUsgm591P2XuMiQ4NxqGjpFmZad3FPZz52I+Chwvnanw gmZOY7JuqGzEujG1pI7qQ1uZxqEZuKKDFDZogCc9bUpoDCbzc3xVWRWeJFfxrp5OSXvO VOaTnFRXWbzVinlPwtE5xDvVla06jNqu9WQ6Ogi4P4T8XRWw7JlcB0STZG/ZQxb/DlSL OnR4qe+u5XsW1tFcM3qFswI+bchYv6pdmck+1v25Hk/D4rAy4IQmuGq7hMBSCjdiXSIN GxLBAWvoiBqIhHkOSRkThCS8BAB8FFdPGwtAuqfX4mPqJOn1LTyA2/7gucl+oCqhcCdV KQRA== 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=hsopG5z7DmoPth+czQ4m5oXG8R0SM5k9cMj1rLEx2eY=; b=mEELH5kOwAyS4+yISWbDOKM14LKMZVUo6bDiRRAsLGSgHi1HfmQ6cccUIqyMmxr6Dq AgoNPquyyFnw7VixEFENApROKnSsh9VNojtbp3KNCQ8DQRVW+R1cS23BtsxOilNkF721 FR2eyQ66/+U5kbRUvs86+2BgGbCXNDt+cb3b9wvZNyGzVn2couVo8XQvjtqAWPWjaweL 3kexvI/fG4tecJwUF/0Vj13zYc74OrM+kQdJZ2uGknrzjlcmuidR8Qx3ccYKhgDc81+n iVhka3jeyCe9M7y81OU8b/gFlUorSWxoRceo/44T2DxkFKD7W21Tky1oyeOlGG+rWGS2 kHPQ== 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 f26si6141907pfn.269.2018.04.06.07.50.44; Fri, 06 Apr 2018 07:51:12 -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 S1755523AbeDFNdL (ORCPT + 99 others); Fri, 6 Apr 2018 09:33:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57746 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755179AbeDFNdH (ORCPT ); Fri, 6 Apr 2018 09:33:07 -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 F0B958A5; Fri, 6 Apr 2018 13:33:05 +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.9 018/102] cpumask: Add helper cpumask_available() Date: Fri, 6 Apr 2018 15:22:59 +0200 Message-Id: <20180406084334.167293827@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@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.9-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 @@ -680,6 +680,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]; @@ -720,6 +725,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,