Skip to content

Commit e68808a

Browse files
committed
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 "[email protected]" # gpg: Good signature from "Markus Armbruster <[email protected]>" [full] # gpg: aka "Markus Armbruster <[email protected]>" [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 <[email protected]>
2 parents 7adfbea + 192cf54 commit e68808a

File tree

5 files changed

+31
-9
lines changed

5 files changed

+31
-9
lines changed

hw/i386/intel_iommu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,7 @@ static bool vtd_process_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc)
23562356
if ((inv_desc->lo & VTD_INV_DESC_IOTLB_RSVD_LO) ||
23572357
(inv_desc->hi & VTD_INV_DESC_IOTLB_RSVD_HI)) {
23582358
error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2359-
", lo=0x%"PRIx64" (reserved bits unzero)\n",
2359+
", lo=0x%"PRIx64" (reserved bits unzero)",
23602360
__func__, inv_desc->hi, inv_desc->lo);
23612361
return false;
23622362
}
@@ -2377,7 +2377,7 @@ static bool vtd_process_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc)
23772377
am = VTD_INV_DESC_IOTLB_AM(inv_desc->hi);
23782378
if (am > VTD_MAMV) {
23792379
error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2380-
", lo=0x%"PRIx64" (am=%u > VTD_MAMV=%u)\n",
2380+
", lo=0x%"PRIx64" (am=%u > VTD_MAMV=%u)",
23812381
__func__, inv_desc->hi, inv_desc->lo,
23822382
am, (unsigned)VTD_MAMV);
23832383
return false;
@@ -2387,7 +2387,7 @@ static bool vtd_process_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc)
23872387

23882388
default:
23892389
error_report_once("%s: invalid iotlb inv desc: hi=0x%"PRIx64
2390-
", lo=0x%"PRIx64" (type mismatch: 0x%llx)\n",
2390+
", lo=0x%"PRIx64" (type mismatch: 0x%llx)",
23912391
__func__, inv_desc->hi, inv_desc->lo,
23922392
inv_desc->lo & VTD_INV_DESC_IOTLB_G);
23932393
return false;

hw/sd/milkymist-memcard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
281281
carddev = qdev_new(TYPE_SD_CARD);
282282
qdev_prop_set_drive(carddev, "drive", blk);
283283
if (!qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err)) {
284-
error_propagate_prepend(errp, err, "failed to init SD card: %s");
284+
error_propagate_prepend(errp, err, "failed to init SD card");
285285
return;
286286
}
287287
s->enabled = blk && blk_is_inserted(blk);

include/qapi/error.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,15 @@ void error_propagate(Error **dst_errp, Error *local_err);
382382
* Please use ERRP_GUARD() and error_prepend() instead when possible.
383383
*/
384384
void error_propagate_prepend(Error **dst_errp, Error *local_err,
385-
const char *fmt, ...);
385+
const char *fmt, ...)
386+
GCC_FMT_ATTR(3, 4);
386387

387388
/*
388389
* Prepend some text to @errp's human-readable error message.
389390
* The text is made by formatting @fmt, @ap like vprintf().
390391
*/
391-
void error_vprepend(Error *const *errp, const char *fmt, va_list ap);
392+
void error_vprepend(Error *const *errp, const char *fmt, va_list ap)
393+
GCC_FMT_ATTR(2, 0);
392394

393395
/*
394396
* Prepend some text to @errp's human-readable error message.
Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
// Error messages should not contain newlines. This script finds
22
// messages that do. Fixing them is manual.
33
@r@
4-
expression errp, eno, cls, fmt;
4+
expression errp, err, eno, cls, fmt, ap;
55
position p;
66
@@
77
(
8+
error_vreport(fmt, ap)@p
9+
|
10+
warn_vreport(fmt, ap)@p
11+
|
12+
info_vreport(fmt, ap)@p
13+
|
814
error_report(fmt, ...)@p
915
|
16+
warn_report(fmt, ...)@p
17+
|
18+
info_report(fmt, ...)@p
19+
|
20+
error_report_once(fmt, ...)@p
21+
|
22+
warn_report_once(fmt, ...)@p
23+
|
1024
error_setg(errp, fmt, ...)@p
1125
|
1226
error_setg_errno(errp, eno, fmt, ...)@p
1327
|
1428
error_setg_win32(errp, eno, cls, fmt, ...)@p
1529
|
30+
error_propagate_prepend(errp, err, fmt, ...)@p
31+
|
32+
error_vprepend(errp, fmt, ap)@p
33+
|
1634
error_prepend(errp, fmt, ...)@p
1735
|
1836
error_setg_file_open(errp, eno, cls, fmt, ...)@p
1937
|
38+
warn_reportf_err(errp, fmt, ...)@p
39+
|
2040
error_reportf_err(errp, fmt, ...)@p
2141
|
2242
error_set(errp, cls, fmt, ...)@p
@@ -26,4 +46,4 @@ fmt << r.fmt;
2646
p << r.p;
2747
@@
2848
if "\\n" in str(fmt):
29-
print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt)
49+
print("%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt))

target/ppc/mmu-hash64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ static int build_vrma_slbe(PowerPCCPU *cpu, ppc_slb_t *slb)
859859
}
860860

861861
error_report("Bad page size encoding in LPCR[VRMASD]; LPCR=0x"
862-
TARGET_FMT_lx"\n", lpcr);
862+
TARGET_FMT_lx, lpcr);
863863

864864
return -1;
865865
}

0 commit comments

Comments
 (0)