Received: by 10.213.65.68 with SMTP id h4csp718703imn; Fri, 6 Apr 2018 07:48:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx48u5vLM1XTEpt8Nc/HxEOSTkhYtgJ8GpxKHthBEmuHC92W44kTwpB6mI9uxYGD+d3sw5g1l X-Received: by 10.167.130.2 with SMTP id k2mr16764177pfi.14.1523026094623; Fri, 06 Apr 2018 07:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523026094; cv=none; d=google.com; s=arc-20160816; b=LPs0r56d/XFjnKgkb409Er5GgUN/xaojb7YxuYUekefOqUo7ndE3WJBpz312N1jS7h /7VYYygJVxRvd4hn3e+K+e50UHguPHnOp3CAWkNXoD/pGZp6zRSw8tGcOP+qvLD2NwZq WitgEpFFNJNc5cBtlTTVRQYZP1rdWGVbqZoE8ysORYFvYC8Fc4v2H8RTZDiEQCechx4y XkQi/MN5+jb6aPOwQtgjLj2xhcVwNI4bH5JWoOUcQFIbhj0/0klJurPA82//qEk0dUDZ CYzJrLL6A7wP16GDpzPypznUYCp+BInt/iYv2VaPIlFYhOqL8jdcs4SP6OvWNiOqWuSJ ruTg== 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=ouT+S3CznIqnBaDlN/1zTXjTjhguu2LEZNGyzfnng3c=; b=BczhQtKoofgbV+ZML+LvDNvBWTilRsruyez1Jyq12AJa8uttCwL1eHmrrd/nLid3QI T9nufP7Ha3ESk15D9N+sB8yLEwZjMAfjsrOPzZXdy2LH267vIO0culu67m508/WotvwM nxhPVubY9xuSjcUo5UYHYWN8afGfLK//81EVi9dhyUEa80noM3UObmoE6gXO3FE0Xfqy CKCoceb7Fnxz6ll/Z8gpk5HtKztiZF1Fhripfz4ZEzl/rof27DWswD2/vtDivj2dbiwV 0in9sGoYK6JwyQpI9BY+yBPjviJsEvNpILptuKgM/iQKHdI1QxVZXbiCAnGDttYlXRr3 lVfw== 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 b8-v6si10024713pll.146.2018.04.06.07.48.00; Fri, 06 Apr 2018 07:48:14 -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 S1755886AbeDFOq7 (ORCPT + 99 others); Fri, 6 Apr 2018 10:46:59 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57976 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755657AbeDFNdj (ORCPT ); Fri, 6 Apr 2018 09:33:39 -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 A9A94CC9; Fri, 6 Apr 2018 13:33:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Johannes Berg , Nathan Chancellor Subject: [PATCH 4.9 029/102] mac80211: Fix clang warning about constant operand in logical operation Date: Fri, 6 Apr 2018 15:23:10 +0200 Message-Id: <20180406084335.741649547@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 93f56de259376d7e4fff2b2d104082e1fa66e237 upstream. When clang detects a non-boolean constant in a logical operation it generates a 'constant-logical-operand' warning. In ieee80211_try_rate_control_ops_get() the result of strlen() is used in a logical operation, clang resolves the expression to an (integer) constant at compile time when clang's builtin strlen function is used. Change the condition to check for strlen() > 0 to make the constant operand boolean and thus avoid the warning. Signed-off-by: Matthias Kaehlcke Signed-off-by: Johannes Berg Cc: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- net/mac80211/rate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -173,9 +173,11 @@ ieee80211_rate_control_ops_get(const cha /* try default if specific alg requested but not found */ ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo); - /* try built-in one if specific alg requested but not found */ - if (!ops && strlen(CONFIG_MAC80211_RC_DEFAULT)) + /* Note: check for > 0 is intentional to avoid clang warning */ + if (!ops && (strlen(CONFIG_MAC80211_RC_DEFAULT) > 0)) + /* try built-in one if specific alg requested but not found */ ops = ieee80211_try_rate_control_ops_get(CONFIG_MAC80211_RC_DEFAULT); + kernel_param_unlock(THIS_MODULE); return ops;