Skip to content

Commit b0a997f

Browse files
Mauricio Faria de Oliveiraksacilotto
authored andcommitted
partitions/aix: append null character to print data from disk
BugLink: https://bugs.launchpad.net/bugs/1787281 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: 6ceea22 ("partitions: add aix lvm partition support files") Suggested-by: Daniel J. Axtens <daniel.axtens@canonical.com> Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> (cherry picked from commit d43fdae7bac2def8c4314b5a49822cb7f08a45f1) Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com> Acked-by: Seth Forshee <seth.forshee@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
1 parent 91ceaff commit b0a997f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

block/partitions/aix.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,14 @@ int aix_partition(struct parsed_partitions *state)
282282
next_lp_ix += 1;
283283
}
284284
for (i = 0; i < state->limit; i += 1)
285-
if (lvip[i].pps_found && !lvip[i].lv_is_contiguous)
285+
if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) {
286+
char tmp[sizeof(n[i].name) + 1]; // null char
287+
288+
snprintf(tmp, sizeof(tmp), "%s", n[i].name);
286289
pr_warn("partition %s (%u pp's found) is "
287290
"not contiguous\n",
288-
n[i].name, lvip[i].pps_found);
291+
tmp, lvip[i].pps_found);
292+
}
289293
kfree(pvd);
290294
}
291295
kfree(n);

0 commit comments

Comments
 (0)