From patchwork Tue Aug 9 16:55:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1665003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M2K7H2198z9sFs for ; Wed, 10 Aug 2022 02:59:55 +1000 (AEST) Received: from localhost ([::1]:53160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLSa9-0000SO-Bz for incoming@patchwork.ozlabs.org; Tue, 09 Aug 2022 12:59:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLSWW-0003Xz-4r; Tue, 09 Aug 2022 12:56:09 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:58625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLSWU-0000Wk-6o; Tue, 09 Aug 2022 12:56:07 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N95Rn-1nIF3K45vr-0169qg; Tue, 09 Aug 2022 18:55:58 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Markus Armbruster , Raphael Norwitz , "Michael S . Tsirkin" , Laurent Vivier Subject: [PULL 1/2] contrib/vhost-user-blk: Clean up deallocation of VuVirtqElement Date: Tue, 9 Aug 2022 18:55:54 +0200 Message-Id: <20220809165555.2415931-2-laurent@vivier.eu> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220809165555.2415931-1-laurent@vivier.eu> References: <20220809165555.2415931-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:vOaBaH04CsT0F8fPesA4TNAeT/+UBajDQyUkC7HbuZCH3SvXAFn 75au4RXBYn13h9BZRLuS3CTcL4ndeptNvzmFMgNvHTr20eue6Gj65bHrO76+QLpO029uI45 DYMwZR8hUNwfTSbjAM7+ImZXd5h73EKnOjT44FF+/EzC3hoXDsUTx/obx+YSria2McPoCnA QjbPM0NBP1MK7y5YvQG4A== X-UI-Out-Filterresults: notjunk:1;V03:K0:on+ghYYnXEU=:6EDhcLfUFt38Or4sVVYdCx MluOvi4tJqfqQI8T0V18fuGK85x87kxqgxSw5shQKt1m/hXiiP+mmFYOdm0X5mHTtpuTGu2xc 2Y5DuWDUBCnL/Mgrp6QOLNhBqLvhSkSWVTN6T0fjdncoXSicFHi2Jql66BMFgkfLtohGpkUbY zYNlL+ArQfTvHuWqst6nDpY0jmZoc6PSjXZMrkyp5Q3GoBQqB18CSTjc0Kghg9vsoPTHY56aD uci8wIs2UNuXUj9pnGsx3/0S/t6nUxQGU1Ekwb3Ifg/6DJckDPM78MR1YwUZ6aDolrk7W2Nao tQwFp7MDcQd9Naz/62ujoPiR1DDm/q2B3hHhR+mjGdpeBNc7E/J3RcgK2kvc5JapayNw59Q/i TvUwfZbMJsZynTw4l4DQkAgicXQ8uqo+ICEpT+h+fF2vxJX+Nwh1tRNP11+jMUsmBdfsFcbug 69I8J7YwzKuKrwUTHIKfOmIKmVTWap5ipHgMOj/LX7cp1J+r48u4n1sM9QmvIksad+AYyRJKJ mC1ce2cm9zChhv8q58XBC+JXSl1GrDASV8KtxHPHhj5G8SPeu0P69IYyALpOL+TBp9CBqaScx /d6KgGuXr+uiPXjIo1/0PJcxYD8nVceRNTB1LolJ8nUpF1YNFOjy2z3iVA/LFSiS021e1pOyj fxyt+n86s/bKHqCAzRVEEp0Ygwyn0YG78SFmggNBwZAPU+y8kxxGb8jkNSOQFxirp0sGC/MUX LqtOTxpeTu/FzPBId3pDRSDovn6LjO/JbZo7ew== Received-SPF: none client-ip=212.227.126.187; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Markus Armbruster We allocate VuVirtqElement with g_malloc() in virtqueue_alloc_element(), but free it with free() in vhost-user-blk.c. Harmless, but use g_free() anyway. One of the calls is guarded by a "not null" condition. Useless, because it cannot be null (it's dereferenced right before), and even it it could be, free() and g_free() do the right thing. Drop the conditional. Fixes: Coverity CID 1490290 Signed-off-by: Markus Armbruster Reviewed-by: Raphael Norwitz Acked-by: Michael S. Tsirkin Message-Id: <20220630085219.1305519-1-armbru@redhat.com> Signed-off-by: Laurent Vivier --- contrib/vhost-user-blk/vhost-user-blk.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index 9cb78ca1d0df..d6932a264573 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -106,10 +106,7 @@ static void vub_req_complete(VubReq *req) req->size + 1); vu_queue_notify(vu_dev, req->vq); - if (req->elem) { - free(req->elem); - } - + g_free(req->elem); g_free(req); } @@ -243,7 +240,7 @@ static int vub_virtio_process_req(VubDev *vdev_blk, /* refer to hw/block/virtio_blk.c */ if (elem->out_num < 1 || elem->in_num < 1) { fprintf(stderr, "virtio-blk request missing headers\n"); - free(elem); + g_free(elem); return -1; } @@ -325,7 +322,7 @@ static int vub_virtio_process_req(VubDev *vdev_blk, return 0; err: - free(elem); + g_free(elem); g_free(req); return -1; } From patchwork Tue Aug 9 16:55:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1665002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M2K5q5wchz9sFs for ; Wed, 10 Aug 2022 02:58:39 +1000 (AEST) Received: from localhost ([::1]:50092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLSYv-0006mH-Ue for incoming@patchwork.ozlabs.org; Tue, 09 Aug 2022 12:58:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLSWV-0003Xn-0S; Tue, 09 Aug 2022 12:56:07 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:53343) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLSWT-0000Wd-7e; Tue, 09 Aug 2022 12:56:06 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N63i4-1nJcUo2YlU-016QAL; Tue, 09 Aug 2022 18:55:58 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Qiang Liu , Thomas Huth , Frederic Konrad , Laurent Vivier Subject: [PULL 2/2] xlnx_dp: drop unsupported AUXCommand in xlnx_dp_aux_set_command Date: Tue, 9 Aug 2022 18:55:55 +0200 Message-Id: <20220809165555.2415931-3-laurent@vivier.eu> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220809165555.2415931-1-laurent@vivier.eu> References: <20220809165555.2415931-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:tvVm9Hwo5pM5k4ybRnZg0pEMJYU0xo7Rj7Q583DlJO4dXFLiE8B maom5z3gL4GbaBHp6+dh5XHKyl3wzlu7C+mk64KglLuh0rkec7SMG1ViJwcRxUrEIHkm9+r ZHIemQqSGHz/rWVQXvmrm4m6d8rQZno1ix0dc9YMKNgYlOgiWQD2wU0uFRjz5FfeQLBRo2a ZHTd97xFo96ru/aB+EiqQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:A0Dm9r/BfsQ=:v3sD8C1DJrfwR4hl0WkC9p HNtICvgBf9npsAD3wn7AdVHESQvWOOsjg3uLBKSbMuvC//GaXRgEdc0EnHW1T/0VYS9Yx6ayW hmcjEoAmwSxfGbzS3ThVRrWiMIV2uCrtiUmRLsJUmb8LCbSqvLnhrcyytGe8fULej0+Je5AZW pPQBx1PHCqkShCbFML49XvfjGF6l8dQdKX/eENMjJxcTfYryJKfhkwXa4fOqe7H3Qbj0EUKGk Bl6TJauHvhbnaQOX5qdP3HEFzGnZeQgQ/oqGS9K7E5ADMn34LGJR1MX0+C2R4d46691tdzmdy 15iR6pk/nOXtdDPeeXF58uAz9C3z1AcXF8YyJOptAghH2+hrqaexZfwOsklhIIPfqDzuarH3/ C/dSobMZoyV2cODvM9vSOr7X4WEIEihkxA0cegjIcyrHo0ddgBJgTpkQKNajLZe9rXjvSTP2h qyEWV00Kmarl2DJutl+PZ3wtOlt+2itjkn3pLmBxgmjaDHBoxhYA06xW1Mtjq78DD4cNa7JJo VEeLqkzfuvD8vcUrEjdWpZxvDrUFL1SpBGJlxR72j8zMFac8/1ReNHW1BRf2drTc83FOaRzhI h9faYOxsKdRSOgDbKjI7yRN4hbqzMzd4u+gy6O6rxIpZ2t1KRxD6Qu3I/HfvSODDAZWkZy4hl Aoerv3w96HkXj1uNght776a1grKz+QEnUu69GJLLk2YQuh0yfDaUQLvNY0tGYtGCwRVc0c0q3 p0oWXhbYkrcWgfy39ARdizJYcjs8JvkhBVLjjA== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Qiang Liu In xlnx_dp_aux_set_command, when the command leads to the default branch, xlxn-dp will abort and then crash. This patch removes this abort and drops this operation. Fixes: 58ac482 ("introduce xlnx-dp") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/411 Reported-by: Qiang Liu Tested-by: Qiang Liu Suggested-by: Thomas Huth Signed-off-by: Qiang Liu Reviewed-by: Thomas Huth Reviewed-by: Frederic Konrad Message-Id: <20220808080116.2184881-1-cyruscyliu@gmail.com> Signed-off-by: Laurent Vivier --- hw/display/xlnx_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c index a071c818833b..b0828d65aa86 100644 --- a/hw/display/xlnx_dp.c +++ b/hw/display/xlnx_dp.c @@ -532,8 +532,8 @@ static void xlnx_dp_aux_set_command(XlnxDPState *s, uint32_t value) qemu_log_mask(LOG_UNIMP, "xlnx_dp: Write i2c status not implemented\n"); break; default: - error_report("%s: invalid command: %u", __func__, cmd); - abort(); + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid command: %u", __func__, cmd); + return; } s->core_registers[DP_INTERRUPT_SIGNAL_STATE] |= 0x04;