From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41Z4h41sxRzF07t for ; Tue, 24 Jul 2018 01:11:16 +1000 (AEST) In-Reply-To: <20180704152833.2288-1-vaibhav@linux.ibm.com> To: Vaibhav Jain , linuxppc-dev@lists.ozlabs.org, Frederic Barrat , Andrew Donnellan , Dan Carpenter From: Michael Ellerman Cc: Philippe Bergheaud , Vaibhav Jain , Alastair D'Silva , Christophe Lombard , stable@vger.kernel.org Subject: Re: cxl: Fix wrong comparison in cxl_adapter_context_get() Message-Id: <41Z4h41040z9s0R@ozlabs.org> Date: Tue, 24 Jul 2018 01:11:16 +1000 (AEST) List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, 2018-07-04 at 15:28:33 UTC, 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 > Acked-by: Frederic Barrat Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/ef6cb5f1a048fdf91ccee6d63d2bfa cheers