From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762236AbbA3Mjx (ORCPT ); Fri, 30 Jan 2015 07:39:53 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:31912 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761387AbbA3Mjw (ORCPT ); Fri, 30 Jan 2015 07:39:52 -0500 Date: Fri, 30 Jan 2015 15:39:42 +0300 From: Dan Carpenter To: Rickard Strandqvist Cc: Benjamin Romer , David Kershner , devel@driverdev.osuosl.org, Erik Arfvidson , Greg Kroah-Hartman , sparmaintainer@unisys.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: unisys: virtpci: virtpci: Fix for possible null pointer dereference Message-ID: <20150130123942.GY6456@mwanda> References: <1422557426-3929-1-git-send-email-rickard_strandqvist@spectrumdigital.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422557426-3929-1-git-send-email-rickard_strandqvist@spectrumdigital.se> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Run your patches through checkpatch.pl. On Thu, Jan 29, 2015 at 07:50:26PM +0100, Rickard Strandqvist wrote: > - if (dprivate != NULL) > + if (dprivate != NULL) { This is a double negative. Just say "if (dprivate) {". Actually just reverse the test and remove the bogus printk. Say: if (!dprivate) return 0; But *actually* just remove the test entirely because it can never be NULL. Same for virtpci_driver_attr_store(). Btw, if you have the smatch cross function database set up then you can figure out this sort of thing by using: $ smdb.py virtpci_driver_attr_store It says that: fs/sysfs/file.c | sysfs_kf_write | (struct sysfs_ops)->store | PARAM_VALUE | 0 | $ | 4096-2117777777777777777 So this is called from sysfs_kf_write() and parameter zero is a valid pointer. regards, dan carpenter