chardev: fixes for recent record/replay on muxed
PATCH 2/2 chardev: Remove __-prefixed names
In reply to Nicholas PigginPeter points out double underscore prefix names tend to be reserved for the system. Clean these up.
--- chardev/char.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
chardev/char.c +11 -9
@@ -628,8 +628,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 ;
@@ -707,12 +707,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;
@@ -735,7 +735,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;
@@ -760,7 +760,8 @@ out: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,
@@ -768,7 +769,8 @@ static Chardev *qemu_chr_new_permit_mux_mon(const char *label,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,
Signature · 1 line
2.45.2
cover chardev: fixes for recent record/replay on muxed
Fix a couple of issues that Peter found with recent record/replay fix for muxed device.
Thanks,
Nick
Nicholas Piggin (2):
chardev: Fix record/replay error path NULL deref in device creation
chardev: Remove __-prefixed names
chardev/char.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/2 chardev: Fix record/replay error path NULL deref in device creation
qemu_chardev_set_replay() was being called in chardev creation to set up replay parameters even if the chardev is NULL.
A segfault can be reproduced by specifying '-serial chardev:bad' with an rr=record mode.
Fix this with a NULL pointer check.
Resolves: Coverity CID 1559470
--- chardev/char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
chardev/char.c +1 -1
@@ -721,7 +721,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);
Signature · 1 line
2.45.2
Hi
Quoted 10 lines · Nicholas Piggin
Fix a couple of issues that Peter found with recent record/replay fix for muxed device.
Thanks,
NickNicholas Piggin (2):
chardev: Fix record/replay error path NULL deref in device creation
chardev: Remove __-prefixed names
Quoted 8 lines
chardev/char.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)--
2.45.2
Series,
Signature · 1 line
Marc-André Lureau
Re: [PATCH 1/2] chardev: Fix record/replay error path NULL deref in device creation
In reply to Nicholas PigginQuoted 22 lines · Nicholas Piggin
qemu_chardev_set_replay()was being called in chardev creation to set up replay parameters even if the chardev is NULL.A segfault can be reproduced by specifying '-serial chardev:bad' with an rr=record mode.
Fix this with a NULL pointer check.
Reported-by Peter Maydell <[email protected]>Resolves: Coverity CID 1559470
Fixes 4c193bb129dae ("chardev: set record/replay on the base device of a muxed device")Signed-off-by Nicholas Piggin <[email protected]>--- chardev/char.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)chardev/char.c +0
-0
chardev/char.c static Chardev *__qemu_chr_new(const char *label, const char *filename,
Quoted 9 lines
chardev/char.c +1
-2@@ -721,7 +721,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); --
thanks
-- PMM
Re: [PATCH 2/2] chardev: Remove __-prefixed names
In reply to Nicholas PigginQuoted 9 lines · Nicholas Piggin
Peter points out double underscore prefix names tend to be reserved for the system. Clean these up.
Suggested-by Peter Maydell <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- chardev/char.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
thanks
-- PMM
Quoted 2 lines · Nicholas Piggin
Fix a couple of issues that Peter found with recent record/replay fix for muxed device.
Hi,
I've just realised these never got merged. Sorry for losing track of them, I was on vacation when doing them and things got a bit neglected. Looks like I forgot to cc you, Marc-Andre.
Thanks,
Nick