From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dledford@redhat.com
Subject: [PATCH 11/12] fd2devname(): Don't dereference NULL pointer
Date: Wed, 2 Nov 2011 15:42:16 +0100 [thread overview]
Message-ID: <1320244937-9739-12-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1320244937-9739-1-git-send-email-Jes.Sorensen@redhat.com>
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
super-intel.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/super-intel.c b/super-intel.c
index b583b35..f776be9 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -2868,8 +2868,10 @@ static void fd2devname(int fd, char *name)
dname[rv] = '\0';
nm = strrchr(dname, '/');
- nm++;
- snprintf(name, MAX_RAID_SERIAL_LEN, "/dev/%s", nm);
+ if (nm) {
+ nm++;
+ snprintf(name, MAX_RAID_SERIAL_LEN, "/dev/%s", nm);
+ }
}
extern int scsi_get_serial(int fd, void *buf, size_t buf_len);
--
1.7.6.4
next prev parent reply other threads:[~2011-11-02 14:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-02 14:42 [PATCH 00/12] More leak and NULL pointer dereference fixes Jes.Sorensen
2011-11-02 14:42 ` [PATCH 01/12] mdadm: add missing break for UpdateSubarray Jes.Sorensen
2011-11-02 14:42 ` [PATCH 02/12] ping_monitor(): check file descriptor is valid before using and closing it Jes.Sorensen
2011-11-02 14:42 ` [PATCH 03/12] mdstat_read(): Check return value of dup() before using file descriptor Jes.Sorensen
2011-11-02 14:42 ` [PATCH 04/12] get_component_size(): Check read() return value for error before using it Jes.Sorensen
2011-11-02 14:42 ` [PATCH 05/12] array_try_spare(): open_dev() returns -1 on error, not zero Jes.Sorensen
2011-11-02 14:42 ` [PATCH 06/12] disk_init_and_add(): Fail if opening sysfs file descriptors fail Jes.Sorensen
2011-11-02 14:42 ` [PATCH 07/12] close_aa(): Verify file descriptors are valid before trying to close them Jes.Sorensen
2011-11-02 14:42 ` [PATCH 08/12] ahci_enumerate_ports(): Don't close fd that failed to open Jes.Sorensen
2011-11-02 14:42 ` [PATCH 09/12] unblock_monitor(): Check sra is valid before dereferencing Jes.Sorensen
2011-11-02 14:42 ` [PATCH 10/12] Manage_ro(): Check pointer rather than dereferencing it Jes.Sorensen
2011-11-02 14:42 ` Jes.Sorensen [this message]
2011-11-02 14:42 ` [PATCH 12/12] match_metadata_desc(): Fix memory leak Jes.Sorensen
2011-11-02 21:12 ` [PATCH 00/12] More leak and NULL pointer dereference fixes NeilBrown
2011-11-03 12:40 ` Jes Sorensen
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=1320244937-9739-12-git-send-email-Jes.Sorensen@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=dledford@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).