Received: by 10.223.164.202 with SMTP id h10csp2969597wrb; Tue, 28 Nov 2017 04:22:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMYmvI+kksMo6yq6bAF/ivoopGPeOU1ZgRdw/vizRBnOxyCu+R2GoCRqSjD2hmc2gkUnXSWV X-Received: by 10.84.224.206 with SMTP id k14mr42372191pln.403.1511871728339; Tue, 28 Nov 2017 04:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511871728; cv=none; d=google.com; s=arc-20160816; b=YAv9f/0lC5evGUB135ROZJut79j/EoAcZ3Pr3XIT+i3H24Jddsets+LIFXqXMX2gSs X5MK/1Km+YkA9ct1vQJEgh09x5beswBrY5YI/qB19Yesy0w9u52pRWUHb/LTrFMds466 f8zSxXhrEHRv0NVQOdqX1+K0hnPg0sCKkr6MeLntov/9IIP8dOkl3FL8+/UUnqPuS8AT wPKNqvohZMn8aOTxi9ZfH7qWz3h6iRMxp6H+PBheMXgrJFFJrdA/UM0QVmtt35UfJ+Zd 8TJiK++NbHMTTn777JGhCh+dFF1tupdDBsg+E0QfymtM5WW861iKuPZ3c++iveOqiXg+ LcEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=yP1ZEcsKkMPee2/bGomgr61kYIiKAWyXzsJG1sgGUKg=; b=DkkmjV9e8XtPfLcEk81CFuX4cjAHS0zguBIKmw/g0tGwuaUHL4rTpqjrVkbuqhWzWa odc/gVmf3o0nUgITaFglxVa5CDolPmlACky8IoirUa8GTrppvBP/2ZEGr6GHPON8sDO8 QDK76ai4Vj26qd+BbG3FnEuB7DEPkHjeBT+qLpnKytAu2ikv66WUOc2MOiM7bTeCiqqJ rvCU9bhrSkl2tmvT1CjY6lLL8YWkZIcP2vA+GBMcMLjyp/PIoSk39Mz0bbNNfh3BM19/ GNp1DB2kA4jSXHsxryQfyMsXzFbd+6pGTsFHbxOUTgXTo+5Z6wtbkJhd2wyNBu+Zt1BA /37w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@prevas.dk header.s=ironport1 header.b=TjC7axz9; 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 11si25482390plf.786.2017.11.28.04.21.52; Tue, 28 Nov 2017 04:22:08 -0800 (PST) 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; dkim=fail header.i=@prevas.dk header.s=ironport1 header.b=TjC7axz9; 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 S1753995AbdK1MTz (ORCPT + 77 others); Tue, 28 Nov 2017 07:19:55 -0500 Received: from mail01.prevas.se ([62.95.78.3]:2416 "EHLO mail01.prevas.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753760AbdK1MTx (ORCPT ); Tue, 28 Nov 2017 07:19:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=1186; q=dns/txt; s=ironport1; t=1511871593; x=1543407593; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=ItsISK1nt/qyec29UyRc8w91FKjSy4DfcyjsPoGeXJo=; b=TjC7axz9Q/J8PSpusc6nd57tuxCBS3T0Inn1VjDpqVMh9syy4eYlL8Jf mDgvX8Us4Nf+jFfWZM0xXO4HQTzcJDVBfCGiNSQOqnljoZkbi35gJWjRP oc0WJeYz9xIVNPZ8B6wXw3WUgo3vJVmWEFySqBCBB8XXULRUE4vhgjxGw U=; X-IronPort-AV: E=Sophos;i="5.44,468,1505772000"; d="scan'208";a="2880373" Received: from vmprevas4.prevas.se (HELO smtp.prevas.se) ([172.16.8.104]) by ironport1.prevas.se with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2017 13:19:51 +0100 Received: from [172.16.11.34] (172.16.8.31) by smtp.prevas.se (172.16.8.104) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 28 Nov 2017 13:19:50 +0100 Subject: Re: [PATCH] genirq: Make - vs ?: precedence explicit To: Kees Cook , Thomas Gleixner CC: References: <20171122205645.GA27125@beast> From: Rasmus Villemoes Message-ID: Date: Tue, 28 Nov 2017 13:19:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20171122205645.GA27125@beast> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.16.8.31] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017-11-22 21:56, Kees Cook wrote: > Noticed with a Clang build. This improves the readability of the ?: > expression, as it has lower precedence than the - expression. Show > explicitly that - is evaluated first. > > Cc: Thomas Gleixner > Signed-off-by: Kees Cook > --- > kernel/irq/matrix.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/irq/matrix.c b/kernel/irq/matrix.c > index a3cbbc8191c5..7df2480005f8 100644 > --- a/kernel/irq/matrix.c > +++ b/kernel/irq/matrix.c > @@ -384,7 +384,7 @@ unsigned int irq_matrix_available(struct irq_matrix *m, bool cpudown) > { > struct cpumap *cm = this_cpu_ptr(m->maps); > > - return m->global_available - cpudown ? cm->available : 0; > + return (m->global_available - cpudown) ? cm->available : 0; > } I see that this got applied, and that doesn't change the semantics of the code. But surely the code is and was buggy, right? From the kernel doc, I'm pretty sure the idea is to subtract cm->available if cpudown is true, otherwise subtract 0, i.e. return m->global_available - (cpudown ? cm->available : 0); Rasmus From 1584801275767666053@xxx Wed Nov 22 20:57:53 +0000 2017 X-GM-THRID: 1584801275767666053 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread