valgrind complained about uninitialized memory.
As usual, valgrind was right, although the memory never was
actually referenced.
Signed-off-by: Hannes Reinecke <hare@suse.de>
sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
{
struct udev_device *rport_dev = NULL;
sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
{
struct udev_device *rport_dev = NULL;
char rport_id[32];
unsigned long long tmo = 0;
int ret;
char rport_id[32];
unsigned long long tmo = 0;
int ret;
* then set fast_io_fail, and _then_ set dev_loss_tmo
* to the correct value.
*/
* then set fast_io_fail, and _then_ set dev_loss_tmo
* to the correct value.
*/
if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET &&
mpp->fast_io_fail != MP_FAST_IO_FAIL_ZERO &&
mpp->fast_io_fail != MP_FAST_IO_FAIL_OFF) {
if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET &&
mpp->fast_io_fail != MP_FAST_IO_FAIL_ZERO &&
mpp->fast_io_fail != MP_FAST_IO_FAIL_OFF) {
goto out;
}
if (mpp->fast_io_fail >= tmo) {
goto out;
}
if (mpp->fast_io_fail >= tmo) {
- snprintf(value, 11, "%u", mpp->fast_io_fail);
+ snprintf(value, 16, "%u", mpp->fast_io_fail);
}
} else if (mpp->dev_loss > 600) {
condlog(3, "%s: limiting dev_loss_tmo to 600, since "
"fast_io_fail is not set", rport_id);
}
} else if (mpp->dev_loss > 600) {
condlog(3, "%s: limiting dev_loss_tmo to 600, since "
"fast_io_fail is not set", rport_id);
- snprintf(value, 11, "%u", 600);
+ snprintf(value, 16, "%u", 600);
- snprintf(value, 11, "%u", mpp->dev_loss);
+ snprintf(value, 16, "%u", mpp->dev_loss);
- ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo", value, 11);
+ ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
+ value, strlen(value));
if (ret <= 0) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
if (ret <= 0) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
sprintf(value, "0");
else
else if (mpp->fast_io_fail == MP_FAST_IO_FAIL_ZERO)
sprintf(value, "0");
else
- snprintf(value, 11, "%u", mpp->fast_io_fail);
+ snprintf(value, 16, "%u", mpp->fast_io_fail);
ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
if (ret <= 0) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
if (ret <= 0) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
- snprintf(value, 11, "%u", mpp->dev_loss);
+ snprintf(value, 16, "%u", mpp->dev_loss);
ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
if (ret <= 0) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
if (ret <= 0) {
if (ret == -EBUSY)
condlog(3, "%s: rport blocked", rport_id);
static int
common_sysfs_pathinfo (struct path * pp)
{
static int
common_sysfs_pathinfo (struct path * pp)
{
if (!pp->udev) {
condlog(4, "%s: udev not initialised", pp->dev);
return 1;
if (!pp->udev) {
condlog(4, "%s: udev not initialised", pp->dev);
return 1;
condlog(3, "%s: mask = 0x%x", pp->dev, mask);
/*
condlog(3, "%s: mask = 0x%x", pp->dev, mask);
/*
int fd;
ssize_t size = -1;
int fd;
ssize_t size = -1;
- if (!dev || !attr_name || !value)
+ if (!dev || !attr_name || !value || !value_len)
return 0;
snprintf(devpath, PATH_SIZE, "%s/%s", udev_device_get_syspath(dev),
return 0;
snprintf(devpath, PATH_SIZE, "%s/%s", udev_device_get_syspath(dev),
+ if (!pp->udev || !size)
if (sysfs_attr_get_value(pp->udev, "size", attr, 255) == 0) {
condlog(3, "%s: No size attribute in sysfs", pp->dev);
return 1;
if (sysfs_attr_get_value(pp->udev, "size", attr, 255) == 0) {
condlog(3, "%s: No size attribute in sysfs", pp->dev);
return 1;
if (r != 1) {
condlog(3, "%s: Cannot parse size attribute", pp->dev);
if (r != 1) {
condlog(3, "%s: Cannot parse size attribute", pp->dev);