[Qemu-devel] [PATCH] qxl: check qxl_phys2virt return value

Gerd Hoffmann posted 1 patch 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181005134608.1251-1-kraxel@redhat.com
Test docker-clang@ubuntu failed
Test checkpatch passed
hw/display/qxl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] qxl: check qxl_phys2virt return value
Posted by Gerd Hoffmann 7 years, 1 month ago
Fixes: CID 1395986
Fixes: 979f7ef8966bc4495a710ed9e4af42098f92ee79
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 747986478f..bbf14fb42f 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -290,7 +290,7 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)
     }
 
     cfg = qxl_phys2virt(qxl, qxl->guest_monitors_config, MEMSLOT_GROUP_GUEST);
-    if (cfg->count == 1) {
+    if (cfg != NULL && cfg->count == 1) {
         qxl->guest_primary.resized = 1;
         qxl->guest_head0_width  = cfg->heads[0].width;
         qxl->guest_head0_height = cfg->heads[0].height;
-- 
2.9.3


Re: [Qemu-devel] [PATCH] qxl: check qxl_phys2virt return value
Posted by Philippe Mathieu-Daudé 7 years, 1 month ago
On 05/10/2018 15:46, Gerd Hoffmann wrote:
> Fixes: CID 1395986

Thomas suggested yesterday [*] to use the 'Buglink:' tag, however I
can't find direct link to Coverity IDs.

[*]
https://wiki.qemu.org/Contribute/SubmitAPatch#Write_a_meaningful_commit_message

If your patch fixes a commit that is already in the repository, please
add a line with "Fixes: <full-SHA-commit-id>" below the patch
description / before your "Signed-off-by:" line in the commit message.
If your patch addresses a bug in a public bug tracker, please add a line
with "Buglink: <URL-of-the-bug>" there, too.

> Fixes: 979f7ef8966bc4495a710ed9e4af42098f92ee79> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  hw/display/qxl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index 747986478f..bbf14fb42f 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -290,7 +290,7 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)
>      }
>  
>      cfg = qxl_phys2virt(qxl, qxl->guest_monitors_config, MEMSLOT_GROUP_GUEST);
> -    if (cfg->count == 1) {
> +    if (cfg != NULL && cfg->count == 1) {
>          qxl->guest_primary.resized = 1;
>          qxl->guest_head0_width  = cfg->heads[0].width;
>          qxl->guest_head0_height = cfg->heads[0].height;
>