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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95EBDC433EF for ; Tue, 26 Oct 2021 18:37:51 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0225260F9B for ; Tue, 26 Oct 2021 18:37:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0225260F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Hf0tj24WQz3bYD for ; Wed, 27 Oct 2021 05:37:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=g30x3pZv; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=gustavoars@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=g30x3pZv; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Hf0sz5nLXz2xCd for ; Wed, 27 Oct 2021 05:37:11 +1100 (AEDT) Received: by mail.kernel.org (Postfix) with ESMTPSA id D25DF60E05; Tue, 26 Oct 2021 18:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635273428; bh=1xQXVhbF8/BGLuvjiPQZc83KtW2+s7akCS60PQNrPZg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g30x3pZvp/LbCs0Ax/nHYsd74I1JEAOKbTMArMvXnNkfibGEYWkLJSFx4Zytob6Bl F1iMT7y2fiD6zrj/XCf6jOAgGtDVvBg5gxOJcaZMoMO6MCAm4MmSWUh7cNAbG0hsWp ki9rEZgjxnq43vVD/BUU2qEJX3Evz4S9ttVDkFK5xVQsAiZq/r0lA/ptW4GANCPQmO raVqRcux30VB2ahlzI9+PnTXjazdX0SySkBbWjXHYc1MDw4zw2Xo5ABQvPpKr6Afoi koSXsza+Ospt210rf7g2WHLxvkljZOkaszX1Tkkr38o4AWaSI2FRkH0Wty5/q27pIJ iGjvwPiqXqKPQ== Date: Tue, 26 Oct 2021 13:42:01 -0500 From: "Gustavo A. R. Silva" To: Tyrel Datwyler Subject: Re: [PATCH][next] powerpc/vas: Fix potential NULL pointer dereference Message-ID: <20211026184201.GB1457721@embeddedor> References: <20211015050345.GA1161918@embeddedor> <97c42e43-15b9-5db6-d460-dbb16f31954d@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97c42e43-15b9-5db6-d460-dbb16f31954d@linux.ibm.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haren Myneni , linux-kernel@vger.kernel.org, Nicholas Piggin , Paul Mackerras , linux-hardening@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Oct 18, 2021 at 02:09:31PM -0700, Tyrel Datwyler wrote: > On 10/14/21 10:03 PM, Gustavo A. R. Silva wrote: > > (!ptr && !ptr->foo) strikes again. :) > > > > The expression (!ptr && !ptr->foo) is bogus and in case ptr is NULL, > > it leads to a NULL pointer dereference: ptr->foo. > > > > Fix this by converting && to || > > > > This issue was detected with the help of Coccinelle, and audited and > > fixed manually. > > > > Fixes: 1a0d0d5ed5e3 ("powerpc/vas: Add platform specific user window operations") > > Cc: stable@vger.kernel.org > > Signed-off-by: Gustavo A. R. Silva > Looking at the usage pattern it is obvious that if we determine !ptr attempting > to also confirm !ptr->ops is going to blow up. > > LGTM. > > Reviewed-by: Tyrel Datwyler I think I'll take this in my tree. Thanks, Tyrel. -- Gustavo