Commit 23d39f63aa87e812fd879b8bc32ee6ccfe733de3
Committed by
Alasdair G Kergon
1 parent
ac1f0ac22c
Exists in
master
and in
7 other branches
dm ioctl: allow dm_copy_name_and_uuid to return only one field
Allow NULL buffer in dm_copy_name_and_uuid if you only want to return one of the fields. (Required by a following patch that adds these fields to sysfs.) Signed-off-by: Milan Broz <mbroz@redhat.com> Reviewed-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
drivers/md/dm-ioctl.c
... | ... | @@ -1550,8 +1550,10 @@ |
1550 | 1550 | goto out; |
1551 | 1551 | } |
1552 | 1552 | |
1553 | - strcpy(name, hc->name); | |
1554 | - strcpy(uuid, hc->uuid ? : ""); | |
1553 | + if (name) | |
1554 | + strcpy(name, hc->name); | |
1555 | + if (uuid) | |
1556 | + strcpy(uuid, hc->uuid ? : ""); | |
1555 | 1557 | |
1556 | 1558 | out: |
1557 | 1559 | up_read(&_hash_lock); |