Error reporting patches patches for 2020-07-24

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAl8a3DASHGFybWJydUBy
 ZWRoYXQuY29tAAoJEDhwtADrkYZT3McQALCwXRL6k4QEZpJooo7F4kmhBV2/gcbN
 iwPacfq1f3Dk0kJOOX26dLbq5ZIBBSan9ynVvMePf2a24Q2rfW7CwGyc8VlD/F1Y
 OU4knHmhDPpyX52Dw7UEEOhTJiRpXDLbLrkmUkEwp2Z71m5KU0m1YV6i9BOrOlQz
 bZU/hjCg53lDfDsA5XEZt1/YmRoCqKNco8gLScrjAzcZsos5FWzH0D1APeABQunq
 w4ivHcxGLGLbf7jvIcUnbdZAeG2rCsD9bY0gYmIuuc33rPMEgboqoUnSv3hdT2WS
 tL3gehBCX1Y7nXYFR81RuLYhi/HzFYGCPkNu4JrLdX+8oe3zDZiyFwocuWVtV7zl
 i06zd68Q0byirUWRjLKfCxcYOvt5pflWth40tGJ5QJautCThAEFNnus1yepuXojN
 Waawjk+lyigOTnTAAuTpeJV/zUx+1cVqp5Ou7H3xkT5xo9YfCRrt6OPI9ArwAxqy
 TBMyXbNgocdpryMEKICMq2up1gzbFqjJxlSlJbcpsUulO+icPqxXzSxgcRctNoGB
 Xy1p1/wNF5QCTwFufMGKVeepsfjvRNN8sacgQl1Feew0av2NuoCm0U4uqZIofcX8
 d+x8/VTzR03vjpgvxNjoVfgAtgf+HLVQ2VM6RSU6fxLP1LBqibIUPaYRhj5PFGE2
 esLOl5xKEFRm
 =IXo+
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Peter Maydell 2020-07-24 16:24:42 +01:00
commit e68808a797
5 changed files with 31 additions and 9 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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.

View File

@ -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))

View File

@ -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;
}