From: Mauricio Faria de Oliveira <mfo@canonical.com>
To: axboe@kernel.dk
Cc: phdm@macqel.be, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, daniel.axtens@canonical.com
Subject: [PATCH 2/2] partitions/aix: append null character to print data from disk
Date: Wed, 25 Jul 2018 22:46:29 -0300 [thread overview]
Message-ID: <20180726014629.30411-3-mfo@canonical.com> (raw)
In-Reply-To: <20180726014629.30411-1-mfo@canonical.com>
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: 6ceea22bbbc8 ("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>
---
block/partitions/aix.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/block/partitions/aix.c b/block/partitions/aix.c
index 850cbd1860d4..903f3ed175d0 100644
--- a/block/partitions/aix.c
+++ b/block/partitions/aix.c
@@ -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);
--
2.17.1
next prev parent reply other threads:[~2018-07-26 1:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 1:46 [PATCH 0/2] partitions/aix: fix problems due to disk corruption Mauricio Faria de Oliveira
2018-07-26 1:46 ` [PATCH 1/2] partitions/aix: fix usage of uninitialized lv_info and lvname structures Mauricio Faria de Oliveira
2018-07-26 1:46 ` Mauricio Faria de Oliveira [this message]
2018-07-27 15:17 ` [PATCH 0/2] partitions/aix: fix problems due to disk corruption Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180726014629.30411-3-mfo@canonical.com \
--to=mfo@canonical.com \
--cc=axboe@kernel.dk \
--cc=daniel.axtens@canonical.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=phdm@macqel.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®