From patchwork Thu Mar 31 03:51:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keng-Yu Lin X-Patchwork-Id: 89010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 9F043B6F75 for ; Thu, 31 Mar 2011 14:52:34 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q58vu-0002g4-7l; Thu, 31 Mar 2011 03:52:30 +0000 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Q58vR-0002cy-FR for kernel-team@lists.ubuntu.com; Thu, 31 Mar 2011 03:52:01 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by adelie.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Q58vR-0005od-Dl for ; Thu, 31 Mar 2011 03:52:01 +0000 Received: from 114-45-59-58.dynamic.hinet.net ([114.45.59.58] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Q58vQ-000523-Ox for kernel-team@lists.ubuntu.com; Thu, 31 Mar 2011 03:52:01 +0000 From: Keng-Yu Lin To: kernel-team@lists.ubuntu.com Subject: [PATCH 04/11] UBUNTU: SAUCE: (drop after 2.6.39) staging: rts_pstor: potential NULL dereference Date: Thu, 31 Mar 2011 11:51:06 +0800 Message-Id: <1301543473-11146-5-git-send-email-keng-yu.lin@canonical.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1301543473-11146-1-git-send-email-keng-yu.lin@canonical.com> References: <1301543473-11146-1-git-send-email-keng-yu.lin@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Vasiliy Kulikov pci_get_bus_and_slot() may return NULL, but the caller checks wrong variable. Signed-off-by: Vasiliy Kulikov Signed-off-by: Greg Kroah-Hartman BugLink: http://bugs.launchpad.net/bugs/698006 (cherry picked from commit 37af07d19a53924a70ae42faebf968c04a631c8c) Signed-off-by: Keng-Yu Lin --- drivers/staging/rts_pstor/rtsx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c index 9864b1a..2b18379 100644 --- a/drivers/staging/rts_pstor/rtsx.c +++ b/drivers/staging/rts_pstor/rtsx.c @@ -334,7 +334,7 @@ int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val) u8 devfn = (dev << 3) | func; pdev = pci_get_bus_and_slot(bus, devfn); - if (!dev) + if (!pdev) return -1; pci_read_config_byte(pdev, offset, &data);