From patchwork Thu Nov 8 10:08:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 12766 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CC90223E0B for ; Thu, 8 Nov 2012 10:14:29 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 7BEA8A18564 for ; Thu, 8 Nov 2012 10:14:29 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3725444iej.11 for ; Thu, 08 Nov 2012 02:14:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=sbDCEFsp8I95krSXmoe1SKhSCjnhNtuK5seiGQQfU5I=; b=mWJyJ7Bn1wU8WnGLqrD+kB8DnOkMRU2lusVi60p1b3BXd/802WF6sYfQV24Y+zdtfd jIqTPPOBsriCq0L/4a6loiqHXK3HRH98Pa94xr1b/rFzvLSAhMqpYnGWnnTicDPA2Yor OKrT1kxLdq7E6bbp9g1Wvj0DvIfRjCmHcnztetALlP6j/CNE3KEORdEnUqdPAIHkLS4F LTSNPv2ijrJQ7A+1Y/ySvlDK0LQXrLLSW8WSo1Odohv8tlyhRg3MxOzYyDpkdQJd7wVa eoq9UTeY9fr5B4L4J4yNba89u7SJsqXpwm39eWLbwBQylJ5sEt3GmXqGuTtTjcVrOx+U 0G5w== Received: by 10.50.161.169 with SMTP id xt9mr19150537igb.62.1352369668805; Thu, 08 Nov 2012 02:14:28 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp347552igt; Thu, 8 Nov 2012 02:14:28 -0800 (PST) Received: by 10.68.200.193 with SMTP id ju1mr22465661pbc.53.1352369668190; Thu, 08 Nov 2012 02:14:28 -0800 (PST) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by mx.google.com with ESMTPS id ka8si34971907pbc.275.2012.11.08.02.14.28 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Nov 2012 02:14:28 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.41; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pa0-f41.google.com with SMTP id fa10so2060411pad.14 for ; Thu, 08 Nov 2012 02:14:28 -0800 (PST) Received: by 10.68.143.201 with SMTP id sg9mr23027944pbb.32.1352369667946; Thu, 08 Nov 2012 02:14:27 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id m8sm15896110pax.38.2012.11.08.02.14.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Nov 2012 02:14:27 -0800 (PST) From: Sachin Kamat To: linux-mtd@lists.infradead.org Cc: dwmw2@infradead.org, dedekind1@gmail.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/2] mtd: s3c2410: Fix potential NULL pointer dereference error Date: Thu, 8 Nov 2012 15:38:44 +0530 Message-Id: <1352369324-25771-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1352369324-25771-1-git-send-email-sachin.kamat@linaro.org> References: <1352369324-25771-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQnv15AAT+nlKmqEHlltwHEpYw0bPth6n35UvOMbHBzXZoOfQQGom1Ae3cfhnWvvOE2q8HT5 'set' is tested for NULL. But subsequently accessed without the check. Thus making it conditional to avoid NULL pointer dereferencing. Signed-off-by: Sachin Kamat --- drivers/mtd/nand/s3c2410.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index dfb8636..00fc12f 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -730,11 +730,11 @@ static void s3c2410_nand_add_partition(struct s3c2410_nand_info *info, struct s3c2410_nand_mtd *mtd, struct s3c2410_nand_set *set) { - if (set) + if (set) { mtd->mtd.name = set->name; - - mtd_device_parse_register(&mtd->mtd, NULL, NULL, - set->partitions, set->nr_partitions); + mtd_device_parse_register(&mtd->mtd, NULL, NULL, + set->partitions, set->nr_partitions); + } } /**