mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
fix: cov: missed return value test
use the existing error paths
This commit is contained in:
parent
06a4a356db
commit
2217d6396a
@ -465,12 +465,12 @@ static struct raw_locn *_read_metadata_location_vg(struct device_area *dev_area,
|
|||||||
memset(vgnamebuf, 0, sizeof(vgnamebuf));
|
memset(vgnamebuf, 0, sizeof(vgnamebuf));
|
||||||
|
|
||||||
if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, vgnamebuf))
|
if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, vgnamebuf))
|
||||||
return_NULL;
|
goto fail;
|
||||||
|
|
||||||
if (!strncmp(vgnamebuf, vgname, len = strlen(vgname)) &&
|
if (!strncmp(vgnamebuf, vgname, len = strlen(vgname)) &&
|
||||||
(isspace(vgnamebuf[len]) || vgnamebuf[len] == '{'))
|
(isspace(vgnamebuf[len]) || vgnamebuf[len] == '{'))
|
||||||
return rlocn;
|
return rlocn;
|
||||||
|
fail:
|
||||||
log_error("Metadata on %s at %llu has wrong VG name \"%s\" expected %s.",
|
log_error("Metadata on %s at %llu has wrong VG name \"%s\" expected %s.",
|
||||||
dev_name(dev_area->dev),
|
dev_name(dev_area->dev),
|
||||||
(unsigned long long)(dev_area->start + rlocn->offset),
|
(unsigned long long)(dev_area->start + rlocn->offset),
|
||||||
@ -1439,7 +1439,7 @@ int read_metadata_location_summary(const struct format_type *fmt,
|
|||||||
struct raw_locn *rlocn;
|
struct raw_locn *rlocn;
|
||||||
uint32_t wrap = 0;
|
uint32_t wrap = 0;
|
||||||
unsigned int len = 0;
|
unsigned int len = 0;
|
||||||
char buf[NAME_LEN + 1] __attribute__((aligned(8)));
|
char namebuf[NAME_LEN + 1] __attribute__((aligned(8)));
|
||||||
uint64_t max_size;
|
uint64_t max_size;
|
||||||
|
|
||||||
if (!mdah) {
|
if (!mdah) {
|
||||||
@ -1468,20 +1468,22 @@ int read_metadata_location_summary(const struct format_type *fmt,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, buf))
|
memset(namebuf, 0, sizeof(namebuf));
|
||||||
return_0;
|
|
||||||
|
|
||||||
while (buf[len] && !isspace(buf[len]) && buf[len] != '{' &&
|
if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, namebuf))
|
||||||
|
stack;
|
||||||
|
|
||||||
|
while (namebuf[len] && !isspace(namebuf[len]) && namebuf[len] != '{' &&
|
||||||
len < (NAME_LEN - 1))
|
len < (NAME_LEN - 1))
|
||||||
len++;
|
len++;
|
||||||
|
|
||||||
buf[len] = '\0';
|
namebuf[len] = '\0';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that the text metadata in the circular buffer begins with a
|
* Check that the text metadata in the circular buffer begins with a
|
||||||
* valid vg name.
|
* valid vg name.
|
||||||
*/
|
*/
|
||||||
if (!validate_name(buf)) {
|
if (!validate_name(namebuf)) {
|
||||||
log_error("Metadata location on %s at %llu begins with invalid VG name.",
|
log_error("Metadata location on %s at %llu begins with invalid VG name.",
|
||||||
dev_name(dev_area->dev),
|
dev_name(dev_area->dev),
|
||||||
(unsigned long long)(dev_area->start + rlocn->offset));
|
(unsigned long long)(dev_area->start + rlocn->offset));
|
||||||
|
Loading…
Reference in New Issue
Block a user