diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2020-07-24 16:24:42 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-07-24 16:24:42 +0100 |
commit | e68808a797d0c585b0e82e4a788d1ba8899b01eb (patch) | |
tree | dbcef4afd6dd60afb3a8b942056dd7aa2f9dd849 | |
parent | 7adfbea8fd1efce36019a0c2f198ca73be9d3f18 (diff) | |
parent | 192cf54ac5408d21c20c17b3794a632970bbb880 (diff) |
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2020-07-24' into staging
Error reporting patches patches for 2020-07-24
# gpg: Signature made Fri 24 Jul 2020 14:03:44 BST
# gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg: issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653
* remotes/armbru/tags/pull-error-2020-07-24:
qapi/error: Check format string argument in error_*prepend()
sd/milkymist-memcard: Fix format string
error: Strip trailing '\n' from error string arguments (again)
coccinelle/err-bad-newline: Fix for Python 3, and add patterns
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | hw/i386/intel_iommu.c | 6 | ||||
-rw-r--r-- | hw/sd/milkymist-memcard.c | 2 | ||||
-rw-r--r-- | include/qapi/error.h | 6 | ||||
-rw-r--r-- | scripts/coccinelle/err-bad-newline.cocci | 24 | ||||
-rw-r--r-- | target/ppc/mmu-hash64.c | 2 |
5 files changed, 31 insertions, 9 deletions
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 0c286635cf..5284bb68b6 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2356,7 +2356,7 @@ static bool vtd_process_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) if ((inv_desc->lo & VTD_INV_DESC_IOTLB_RSVD_LO) || (inv_desc->hi & VTD_INV_DESC_IOTLB_RSVD_HI)) { error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64 - ", lo=0x%"PRIx64" (reserved bits unzero)\n", + ", lo=0x%"PRIx64" (reserved bits unzero)", __func__, inv_desc->hi, inv_desc->lo); return false; } @@ -2377,7 +2377,7 @@ static bool vtd_process_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) am = VTD_INV_DESC_IOTLB_AM(inv_desc->hi); if (am > VTD_MAMV) { error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64 - ", lo=0x%"PRIx64" (am=%u > VTD_MAMV=%u)\n", + ", lo=0x%"PRIx64" (am=%u > VTD_MAMV=%u)", __func__, inv_desc->hi, inv_desc->lo, am, (unsigned)VTD_MAMV); return false; @@ -2387,7 +2387,7 @@ static bool vtd_process_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) default: error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64 - ", lo=0x%"PRIx64" (type mismatch: 0x%llx)\n", + ", lo=0x%"PRIx64" (type mismatch: 0x%llx)", __func__, inv_desc->hi, inv_desc->lo, inv_desc->lo & VTD_INV_DESC_IOTLB_G); return false; diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index afdb8aa0c0..11f61294fc 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -281,7 +281,7 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp) carddev = qdev_new(TYPE_SD_CARD); qdev_prop_set_drive(carddev, "drive", blk); if (!qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err)) { - error_propagate_prepend(errp, err, "failed to init SD card: %s"); + error_propagate_prepend(errp, err, "failed to init SD card"); return; } s->enabled = blk && blk_is_inserted(blk); diff --git a/include/qapi/error.h b/include/qapi/error.h index 7932594dce..eaa05c4837 100644 --- a/include/qapi/error.h +++ b/include/qapi/error.h @@ -382,13 +382,15 @@ void error_propagate(Error **dst_errp, Error *local_err); * Please use ERRP_GUARD() and error_prepend() instead when possible. */ void error_propagate_prepend(Error **dst_errp, Error *local_err, - const char *fmt, ...); + const char *fmt, ...) + GCC_FMT_ATTR(3, 4); /* * Prepend some text to @errp's human-readable error message. * The text is made by formatting @fmt, @ap like vprintf(). */ -void error_vprepend(Error *const *errp, const char *fmt, va_list ap); +void error_vprepend(Error *const *errp, const char *fmt, va_list ap) + GCC_FMT_ATTR(2, 0); /* * Prepend some text to @errp's human-readable error message. diff --git a/scripts/coccinelle/err-bad-newline.cocci b/scripts/coccinelle/err-bad-newline.cocci index 1316cc86a6..5394421873 100644 --- a/scripts/coccinelle/err-bad-newline.cocci +++ b/scripts/coccinelle/err-bad-newline.cocci @@ -1,22 +1,42 @@ // Error messages should not contain newlines. This script finds // messages that do. Fixing them is manual. @r@ -expression errp, eno, cls, fmt; +expression errp, err, eno, cls, fmt, ap; position p; @@ ( +error_vreport(fmt, ap)@p +| +warn_vreport(fmt, ap)@p +| +info_vreport(fmt, ap)@p +| error_report(fmt, ...)@p | +warn_report(fmt, ...)@p +| +info_report(fmt, ...)@p +| +error_report_once(fmt, ...)@p +| +warn_report_once(fmt, ...)@p +| error_setg(errp, fmt, ...)@p | error_setg_errno(errp, eno, fmt, ...)@p | error_setg_win32(errp, eno, cls, fmt, ...)@p | +error_propagate_prepend(errp, err, fmt, ...)@p +| +error_vprepend(errp, fmt, ap)@p +| error_prepend(errp, fmt, ...)@p | error_setg_file_open(errp, eno, cls, fmt, ...)@p | +warn_reportf_err(errp, fmt, ...)@p +| error_reportf_err(errp, fmt, ...)@p | error_set(errp, cls, fmt, ...)@p @@ -26,4 +46,4 @@ fmt << r.fmt; p << r.p; @@ if "\\n" in str(fmt): - print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt) + print("%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt)) diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index e5baabf0e1..c31d21e6a9 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -859,7 +859,7 @@ static int build_vrma_slbe(PowerPCCPU *cpu, ppc_slb_t *slb) } error_report("Bad page size encoding in LPCR[VRMASD]; LPCR=0x" - TARGET_FMT_lx"\n", lpcr); + TARGET_FMT_lx, lpcr); return -1; } |