virtio-serial-bus: send_control_msg() should not deal with cpkts
commit4e28976e563ad54f6adc5ae00b1fb8224f1a82ca
authorAmit Shah <amit.shah@redhat.com>
Wed, 12 Dec 2012 12:56:09 +0000 (12 18:26 +0530)
committerAmit Shah <amit.shah@redhat.com>
Tue, 18 Dec 2012 07:34:42 +0000 (18 13:04 +0530)
tree0ad707ebc88889f892dd51d9767fc021c4ae2185
parenta75bf146503a94fb900e0dfa0529bd5d1be9fec5
virtio-serial-bus: send_control_msg() should not deal with cpkts

Stuff the cpkt before calling send_control_msg().  This function should
not be concerned about contents of the buffer it receives.

A few code refactorings recently have made making this change easier
than earlier.

Coverity and clang have flagged this code several times in the past
(cpkt->id not set before send_control_event() passed it on to
send_control_msg()).  This will finally eliminate the false-positive.

CC: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
hw/virtio-serial-bus.c