From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC6ADC2D0C1 for ; Thu, 19 Dec 2019 18:48:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C424524686 for ; Thu, 19 Dec 2019 18:48:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781327; bh=letbtSQP/YSdE1Oeu6VrrL5GA1YWFBCC4BEfr7ppU5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ap/EJ4rWzhW9acstbblLL/aE6R0mDZpC8vXyZFQrjzdKSJIUBw+/GqXvKveuqFa7t b09/Qy/Orpm9Sssw59KSLweHDReJaRld4OYJsB22jTIjlFkwfTBRRh1qp/mxoMqC9+ V/oj0qOlp756aimsvITbEp/e8EzANgC2KEFFQ+zs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727964AbfLSSsr (ORCPT ); Thu, 19 Dec 2019 13:48:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:41898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729671AbfLSSsn (ORCPT ); Thu, 19 Dec 2019 13:48:43 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A75A24682; Thu, 19 Dec 2019 18:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781323; bh=letbtSQP/YSdE1Oeu6VrrL5GA1YWFBCC4BEfr7ppU5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lhm7GvBetAkTCiIj0Ul2VaaT9b71pqTvj1mWcHMn4/KxwjUN82eeNVtFUe4XzlrP5 hdTcJdYSRhHMbj9+WfHReAa/t469WJxvPa6Yr+GiGkusTSKT7YvKauhhVoooV9TBhx zVi7jLyWD3QYqWg//sLQdFbx/DYibSk0cG3ioy9o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Bornyakov , Max Gurtovoy , Keith Busch , Guenter Roeck Subject: [PATCH 4.9 175/199] nvme: host: core: fix precedence of ternary operator Date: Thu, 19 Dec 2019 19:34:17 +0100 Message-Id: <20191219183225.247358027@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183214.629503389@linuxfoundation.org> References: <20191219183214.629503389@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ivan Bornyakov commit e9a9853c23c13a37546397b61b270999fd0fb759 upstream. Ternary operator have lower precedence then bitwise or, so 'cdw10' was calculated wrong. Signed-off-by: Ivan Bornyakov Reviewed-by: Max Gurtovoy Signed-off-by: Keith Busch Cc: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/host/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1043,7 +1043,7 @@ static int nvme_pr_reserve(struct block_ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, enum pr_type type, bool abort) { - u32 cdw10 = nvme_pr_type(type) << 8 | abort ? 2 : 1; + u32 cdw10 = nvme_pr_type(type) << 8 | (abort ? 2 : 1); return nvme_pr_command(bdev, cdw10, old, new, nvme_cmd_resv_acquire); } @@ -1055,7 +1055,7 @@ static int nvme_pr_clear(struct block_de static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) { - u32 cdw10 = nvme_pr_type(type) << 8 | key ? 1 << 3 : 0; + u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); }