From patchwork Mon Nov 20 15:04:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 745361 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1338357wrt; Mon, 20 Nov 2023 07:04:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IH62Y7BbFKjpeJqyUHEFIEkNHUQdvrbLqAHJxz96jW+/E5lgYLgA/o/9Eoh9s54cQmSKiY9 X-Received: by 2002:a1f:eb41:0:b0:48d:2bcf:f959 with SMTP id j62-20020a1feb41000000b0048d2bcff959mr6465568vkh.3.1700492685644; Mon, 20 Nov 2023 07:04:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700492685; cv=none; d=google.com; s=arc-20160816; b=04zjhdJUFcaQQCyy4Ff0ZUckmMKpMNCGgpF0fI8hUH1HTn4/fgjt0OL0dFxd1suzsW Fkju0oIx1093O07N4BiRA59eYKJrwnh0x3tUmleL6+dPvP9IspXV63KIC5cwNvSKKqHr PLIfS5/b/0dHQ6MdpCDXMIhbQeEPWOKX7OSBAfxci1nYiO0S8aXfGk6jdFqTUgVENyCg beuO+gRkD5/Dy9Gl6/vjG/WRgoPcs0eLl+WYvjvZkr50YbS+3w9Nd7LAnWbg7lG3fpyl RuVVERh91mh+VaGbg4+mZhQ6UiGo+DDjYPBuvm4sBk2FFaDWmj2GUPzntNPif9S8Vf96 CT+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=d1m4qgp3LT6PkSZWgB9jKarXIzRyOrdJ5ULRTRAQLDM=; fh=6/clk9uc4Vd+q/RBdSJ/5l2kvtmQ5rNM3QQ3N9O0/uw=; b=LA86D+8h5LpBaQxPt884S2qE97w9UdtO9tLm8lIObPHHMQNc7Ve3X4R04LI1D839NF pb+flVdY/MBIeBRGD6TNJlXfrzrcRbE7AqLEyKcPxu8lARO+YNHV3WKODsDRUScbyF4V 1+stUrT0xWPUT42/KwMDYcLudBhyzKdlB+NGfwAmq7xOGlznytKWquk69UeIuKVIW2hj 8tosxdTpsu+PM8UQqlpWcDcRGzfQ/5duHPKV4FWKrJl4Ntu1+18M+hrjvymiBqtBq0vC FRr4y2XSnquCI84jowH9pLR6vYX5pP54EVnK6axaRNY3c6UeM5unKUZOpCuRJpkyMGxg cvKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XbP2T6B4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t12-20020a1faa0c000000b004ac0feefacesi1545941vke.43.2023.11.20.07.04.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 07:04:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XbP2T6B4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r55p7-00045o-91; Mon, 20 Nov 2023 10:04:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r55p5-00045E-SN for qemu-devel@nongnu.org; Mon, 20 Nov 2023 10:04:27 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r55p2-0006cq-Kz for qemu-devel@nongnu.org; Mon, 20 Nov 2023 10:04:27 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40838915cecso16835715e9.2 for ; Mon, 20 Nov 2023 07:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700492663; x=1701097463; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=d1m4qgp3LT6PkSZWgB9jKarXIzRyOrdJ5ULRTRAQLDM=; b=XbP2T6B4jI8N3tA2xNsPDtUjs9xfhS2IhFcCsXYnxy9ADvMt5eFmULey0QI7eaLoUi tx609+Nu4w8PQY9wCqumWfC3Zr5Ab8Vm0M6yDPI4jRySHI4PPExFpFDujBXUcRf3GtzU SCp11oLsZssz2NTp50MPopsVMcVutXYPvHs9KQxmMgVtJNbUrdQ0XBG6DWtpPYqlFi27 gLxnGTnUAk7FaeKb7vbYrctvvUGTG3X6y0o/hEaBfi7hW7RJk3c0vgOgNP7YSKp8pfOE 38PqKZnn8hYRIyo8JuHNebgGLRnb1NCgbnoTcBQzNxgS0YlPgm3Nn9aMjxG23XlNQNeb rbzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700492663; x=1701097463; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d1m4qgp3LT6PkSZWgB9jKarXIzRyOrdJ5ULRTRAQLDM=; b=kNpB87ap9OwDxb9NzNGOixYLRePjOMgK4CbZ5g/sYRWsoFzh969t0DsVSyorXWJD1v 3Yn04HmZhsAG3dJDcKQm2awsf4MBkoLMsdgGw5diy1DUFr2u9yKO6VZIemba14xmrbV7 xqxpwkmVOiZINT62JKs1unXwWxjXUp+FErVH3hmGw+PzP0ZnwkmdUmOm7Wac5dJct5xF U3T2WmSCZWFLGILdxvdrvLShTeVEFECs7CujU8lTuyPn/rjfOgHTeIgLiOKlR+rZSePx MAXaTW1wgkZLs58tdXeaTbLmtDuE1JK6psXQpvXKKtmPrGoPY7E/w1m4XbLEb1myPZ74 AYIw== X-Gm-Message-State: AOJu0YxcocGFOO0c42U/GWywqG06UouD0vY8A/9pyENkYnJDC88TUNww U6GE20tECdxeAgkxaf+iMOknBz+ROUqTTX8YvtU= X-Received: by 2002:a05:600c:1592:b0:40a:5129:c284 with SMTP id r18-20020a05600c159200b0040a5129c284mr5430712wmf.35.1700492662705; Mon, 20 Nov 2023 07:04:22 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.190]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c3b1500b003fe61c33df5sm18466972wms.3.2023.11.20.07.04.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Nov 2023 07:04:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zhenwei Pi , "Gonglei (Arei)" , Markus Armbruster , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= , qemu-stable@nongnu.org Subject: [PATCH-for-8.2 v2] backends/cryptodev: Do not ignore throttle/backends Errors Date: Mon, 20 Nov 2023 16:04:18 +0100 Message-ID: <20231120150418.93443-1-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Both cryptodev_backend_set_throttle() and CryptoDevBackendClass::init() can set their Error** argument. Do not ignore them, return early on failure. Use the ERRP_GUARD() macro as suggested in commit ae7c80a7bd ("error: New macro ERRP_GUARD()"). Cc: qemu-stable@nongnu.org Fixes: e7a775fd9f ("cryptodev: Account statistics") Fixes: 2580b452ff ("cryptodev: support QoS") Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: zhenwei pi Reviewed-by: Gonglei Reviewed-by: Markus Armbruster --- backends/cryptodev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backends/cryptodev.c b/backends/cryptodev.c index e5006bd215..fff89fd62a 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -398,6 +398,7 @@ static void cryptodev_backend_set_ops(Object *obj, Visitor *v, static void cryptodev_backend_complete(UserCreatable *uc, Error **errp) { + ERRP_GUARD(); CryptoDevBackend *backend = CRYPTODEV_BACKEND(uc); CryptoDevBackendClass *bc = CRYPTODEV_BACKEND_GET_CLASS(uc); uint32_t services; @@ -406,11 +407,20 @@ cryptodev_backend_complete(UserCreatable *uc, Error **errp) QTAILQ_INIT(&backend->opinfos); value = backend->tc.buckets[THROTTLE_OPS_TOTAL].avg; cryptodev_backend_set_throttle(backend, THROTTLE_OPS_TOTAL, value, errp); + if (*errp) { + return; + } value = backend->tc.buckets[THROTTLE_BPS_TOTAL].avg; cryptodev_backend_set_throttle(backend, THROTTLE_BPS_TOTAL, value, errp); + if (*errp) { + return; + } if (bc->init) { bc->init(backend, errp); + if (*errp) { + return; + } } services = backend->conf.crypto_services;