public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexanders83@web.de>
To: Artem Bityutskiy <dedekind1@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Cc: Alexander Stein <alexanders83@web.de>, linux-mtd@lists.infradead.org
Subject: [PATCH] UBI: Fix potential NULL-pointer dereference
Date: Fri, 28 Mar 2014 22:04:49 +0100	[thread overview]
Message-ID: <1396040689-12419-1-git-send-email-alexanders83@web.de> (raw)

It's no use to debug print a string before checking on NULL.

Signed-off-by: Alexander Stein <alexanders83@web.de>
---
 drivers/mtd/ubi/kapi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index 3aac1ac..e40864f 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -242,11 +242,11 @@ struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
 	struct ubi_device *ubi;
 	struct ubi_volume_desc *ret;
 
-	dbg_gen("open device %d, volume %s, mode %d", ubi_num, name, mode);
-
 	if (!name)
 		return ERR_PTR(-EINVAL);
 
+	dbg_gen("open device %d, volume %s, mode %d", ubi_num, name, mode);
+
 	len = strnlen(name, UBI_VOL_NAME_MAX + 1);
 	if (len > UBI_VOL_NAME_MAX)
 		return ERR_PTR(-EINVAL);
-- 
1.9.1

             reply	other threads:[~2014-03-28 21:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 21:04 Alexander Stein [this message]
2014-03-31  6:18 ` [PATCH] UBI: Fix potential NULL-pointer dereference Mats Kärrman
2014-03-31  9:46   ` Artem Bityutskiy
2014-03-31 17:00     ` Alexander Stein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396040689-12419-1-git-send-email-alexanders83@web.de \
    --to=alexanders83@web.de \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox