fd2devname(): Don't dereference NULL pointer
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
1471b8b14b
commit
7897de29b5
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue