Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41536 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753074AbeGEBwH (ORCPT ); Wed, 4 Jul 2018 21:52:07 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w651mkIt031209 for ; Wed, 4 Jul 2018 21:52:06 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2k15p676ue-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 04 Jul 2018 21:52:06 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Jul 2018 02:52:04 +0100 Subject: Re: [PATCH] cxl: Fix wrong comparison in cxl_adapter_context_get() To: Vaibhav Jain , linuxppc-dev@lists.ozlabs.org, Frederic Barrat , Dan Carpenter Cc: Christophe Lombard , Philippe Bergheaud , "Alastair D'Silva" , stable@vger.kernel.org References: <20180704152833.2288-1-vaibhav@linux.ibm.com> From: Andrew Donnellan Date: Thu, 5 Jul 2018 11:51:58 +1000 MIME-Version: 1.0 In-Reply-To: <20180704152833.2288-1-vaibhav@linux.ibm.com> Content-Language: en-AU Message-Id: <8ee7ba2c-3de4-5659-0be0-e41aa8aaec80@au1.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: On 05/07/18 01:28, Vaibhav Jain wrote: > Function atomic_inc_unless_negative() returns a bool to indicate > success/failure. However cxl_adapter_context_get() wrongly compares > the return value against '>=0' which will always be true. The patch > fixes this comparison to '==0' there by also fixing this compile time > warning: > > drivers/misc/cxl/main.c:290 cxl_adapter_context_get() > warn: 'atomic_inc_unless_negative(&adapter->contexts_num)' is unsigned > > Cc: stable@vger.kernel.org > Fixes: 70b565bbdb91 ("cxl: Prevent adapter reset if an active context exists") > Reported-by: Dan Carpenter > Signed-off-by: Vaibhav Jain Acked-by: Andrew Donnellan -- Andrew Donnellan OzLabs, ADL Canberra andrew.donnellan@au1.ibm.com IBM Australia Limited