From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751009AbdE3WVu (ORCPT ); Tue, 30 May 2017 18:21:50 -0400 Received: from quartz.orcorp.ca ([184.70.90.242]:51026 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821AbdE3WVt (ORCPT ); Tue, 30 May 2017 18:21:49 -0400 Date: Tue, 30 May 2017 16:21:19 -0600 From: Jason Gunthorpe To: "Gustavo A. R. Silva" Cc: Peter Huewe , Marcel Selhorst , Jarkko Sakkinen , tpmdd-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] char: tpm: fix potential null pointer dereference Message-ID: <20170530222119.GA8643@obsidianresearch.com> References: <20170530220520.GA8713@embeddedgus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170530220520.GA8713@embeddedgus> User-Agent: Mutt/1.5.24 (2015-08-30) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.156 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 30, 2017 at 05:05:20PM -0500, Gustavo A. R. Silva wrote: > NULL check at line 376: if (!chip) {, implies chip might be NULL. > Function dev_get_drvdata() dereference pointer chip. > Move pointer tmp_dev assignment after the NULL check. chip cannot be null in st33zp24_send, please remove the bogus if instead. Jason