Skip to content

Commit

Permalink
Merge tag 'chr-pull-request' of https://gitlab.com/marcandre.lureau/qemu
Browse files Browse the repository at this point in the history
 into staging

chardev patch queue

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmdPCg4cHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5dmTD/4pNcJ7fJzzxtfBDBvy
# +NWlq7nFDOX471g1B+4V91dOT0TbQLRK0hTmPUGc7FF8sCCDgfZOyHN6GA7TdwXG
# 8+oHqFjxaZcrtrSN67wv8n5tyFNm/1hr1IgqhieKjeVt6eT8PJ8rgFESm4zvDOej
# i2jjhDNN2piu9Lr9smhX3I/kJX70cPXRRX2qBlLEPcMKW280RoTRSEIL1jFdilan
# QyPugQm9R0cSayNg27At2HakFZ5HKgu8EyAvvMFvv1gdoGVdq9D+Gk5xruvBnF/P
# 4g7EnCe/YKWfg887LSjIA2Qcp1xEpUPeumUbCm152ikZ7KnwE9Tn/hPt693GjvMn
# WhyOOuxZmvL4AtJbYheskH7N0b/NB2vUT4N4ONkMeubjzfDu8UHw/rL+WpjAZfXW
# YwzcpVHKXXKazTzzKRLUgsoqfllWLTAQDwU5s46UyVmaBBf5qUSbSnr4ZX2nP0X6
# dP1jM2KcDyaKKowmpYGyQzTVqPwTXfyEdmSNnjirbS2Qyh77snd7rqrxXPz2jKm9
# jfb0yN7BWSEuFguyXL0izeCQsBb/rsrZB/tOYWkUeOzAgpm4GlAQuJ+3uAssgmnu
# aq/bYxGEjC1a+fzg8KUj6S+X+Jfp6+4/Y60M4HAMtMGuy6X1UaCBtH+cntS3JjUj
# 7ZBpTXirstW7KxKZ2mJMa2lkHQ==
# =34fm
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 03 Dec 2024 13:39:26 GMT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Marc-André Lureau <[email protected]>" [full]
# gpg:                 aka "Marc-André Lureau <[email protected]>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'chr-pull-request' of https://gitlab.com/marcandre.lureau/qemu:
  chardev: Remove __-prefixed names
  chardev: Fix record/replay error path NULL deref in device creation

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed Dec 3, 2024
2 parents 712f715 + 3c8ab23 commit f07e0ad
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions chardev/char.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ static void qemu_chardev_set_replay(Chardev *chr, Error **errp)
}
}

static Chardev *__qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
bool replay, Error **errp)
static Chardev *do_qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
bool replay, Error **errp)
{
const ChardevClass *cc;
Chardev *base = NULL, *chr = NULL;
Expand Down Expand Up @@ -712,12 +712,12 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
Error **errp)
{
/* XXX: should this really not record/replay? */
return __qemu_chr_new_from_opts(opts, context, false, errp);
return do_qemu_chr_new_from_opts(opts, context, false, errp);
}

static Chardev *__qemu_chr_new(const char *label, const char *filename,
bool permit_mux_mon, GMainContext *context,
bool replay)
static Chardev *qemu_chr_new_from_name(const char *label, const char *filename,
bool permit_mux_mon,
GMainContext *context, bool replay)
{
const char *p;
Chardev *chr;
Expand All @@ -726,7 +726,7 @@ static Chardev *__qemu_chr_new(const char *label, const char *filename,

if (strstart(filename, "chardev:", &p)) {
chr = qemu_chr_find(p);
if (replay) {
if (replay && chr) {
qemu_chardev_set_replay(chr, &err);
if (err) {
error_report_err(err);
Expand All @@ -740,7 +740,7 @@ static Chardev *__qemu_chr_new(const char *label, const char *filename,
if (!opts)
return NULL;

chr = __qemu_chr_new_from_opts(opts, context, replay, &err);
chr = do_qemu_chr_new_from_opts(opts, context, replay, &err);
if (!chr) {
error_report_err(err);
goto out;
Expand All @@ -765,15 +765,17 @@ static Chardev *__qemu_chr_new(const char *label, const char *filename,
Chardev *qemu_chr_new_noreplay(const char *label, const char *filename,
bool permit_mux_mon, GMainContext *context)
{
return __qemu_chr_new(label, filename, permit_mux_mon, context, false);
return qemu_chr_new_from_name(label, filename, permit_mux_mon, context,
false);
}

static Chardev *qemu_chr_new_permit_mux_mon(const char *label,
const char *filename,
bool permit_mux_mon,
GMainContext *context)
{
return __qemu_chr_new(label, filename, permit_mux_mon, context, true);
return qemu_chr_new_from_name(label, filename, permit_mux_mon, context,
true);
}

Chardev *qemu_chr_new(const char *label, const char *filename,
Expand Down

0 comments on commit f07e0ad

Please sign in to comment.