Commit d43fdae7 authored by Mauricio Faria de Oliveira's avatar Mauricio Faria de Oliveira Committed by Jens Axboe

partitions/aix: append null character to print data from disk

Even if properly initialized, the lvname array (i.e., strings)
is read from disk, and might contain corrupt data (e.g., lack
the null terminating character for strings).

So, make sure the partition name string used in pr_warn() has
the null terminating character.

Fixes: 6ceea22b ("partitions: add aix lvm partition support files")
Suggested-by: default avatarDaniel J. Axtens <daniel.axtens@canonical.com>
Signed-off-by: default avatarMauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 14cb2c8a
......@@ -283,10 +283,14 @@ int aix_partition(struct parsed_partitions *state)
next_lp_ix += 1;
}
for (i = 0; i < state->limit; i += 1)
if (lvip[i].pps_found && !lvip[i].lv_is_contiguous)
if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) {
char tmp[sizeof(n[i].name) + 1]; // null char
snprintf(tmp, sizeof(tmp), "%s", n[i].name);
pr_warn("partition %s (%u pp's found) is "
"not contiguous\n",
n[i].name, lvip[i].pps_found);
tmp, lvip[i].pps_found);
}
kfree(pvd);
}
kfree(n);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment