From patchwork Tue Feb 22 15:23:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 545047 Delivered-To: patch@linaro.org Received: by 2002:adf:a34a:0:0:0:0:0 with SMTP id d10csp375641wrb; Tue, 22 Feb 2022 08:13:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjCkRyf2pbL8I8Ij5RAUWTPE9nJEO2w7j6v1l/hJ/T231xmeOMzDbObJxnfqLnL89kWhfv X-Received: by 2002:a05:6214:27ca:b0:432:4eb7:1876 with SMTP id ge10-20020a05621427ca00b004324eb71876mr1612767qvb.81.1645546427031; Tue, 22 Feb 2022 08:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645546427; cv=none; d=google.com; s=arc-20160816; b=GNvnALNaVbLDyKU9xP8BBmqKS4dBD2/126PUn/LPVwggBYCjgUy359bXOvp4i2eF1o rzGsBhFnJLNwaKg8QUb49OtbeDFlJKfJkowFaX97CLr15duv+gNR3557pC37aGuuYLIy xNnxqELB92MfzOzcNvY22ujtWvKsi3AFjdQ+Je3yA1tCXyZcQIub/5nm9hEUG16fyAI4 A+4Nc+9ycoxsI9ar7wz9g0zeUwxUf/XPIm1RsKcUbDcQJxn2k7VSLLKFtE0BOTmc6YE8 U41cKsP2T9q4ah8SR67rbQSB58avrGUc8WFaBd1azJXlX6Yfr2W3AK+7fvErmlR9nNXI qRiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=qfyRPgQZqNWOmMmZUBNoG+a8v7OPabSQK1leZNajt2g=; b=r7JULMXy+mm5+lJUXo4U42PK+jtNsZErQmnfqxwhb0ug25ZsFOSC8nSeKi4kkhXFfx hur4EkRZDIDDmnj5y6goZBOl3AiHYWeioQhvrU991BreDxiybnlmYfT6qhioyvCxcWeX Djp8FS4lbo2m7BT+Gsx8mqJB3QzgyuUzIJiDyFVMBi+7Gv3zUvAjMhJY8g8XcOyL7ATl 4lHCoB/HvlxS6cbhQLwYdSsUmN88BxxWNngbcxHqcdeElCqHtPoBLK9Lc+4S2PvE7Z5u oO3h6YkTVn4FaPOIzLzmIjiUzA2VJBtxPt2xuy28F3beRbOxet/VBNK5U6WAZ5mLX6/k oZ3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=V0FcYyAA; 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=fail (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 w12si36058qko.344.2022.02.22.08.13.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Feb 2022 08:13:47 -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=fail header.i=@linaro.org header.s=google header.b=V0FcYyAA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMXnO-0002nh-H7 for patch@linaro.org; Tue, 22 Feb 2022 11:13:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMX17-0002LL-ES for qemu-devel@nongnu.org; Tue, 22 Feb 2022 10:23:53 -0500 Received: from [2a00:1450:4864:20::434] (port=33321 helo=mail-wr1-x434.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMX10-0004kk-ID for qemu-devel@nongnu.org; Tue, 22 Feb 2022 10:23:52 -0500 Received: by mail-wr1-x434.google.com with SMTP id j17so7291171wrc.0 for ; Tue, 22 Feb 2022 07:23:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qfyRPgQZqNWOmMmZUBNoG+a8v7OPabSQK1leZNajt2g=; b=V0FcYyAAR35Fd+dGdVJB10nQMdBS+EeAMBxL29zeSJvPxAun/3ZHEBlN3YPScUwmEI lMvKIXt7x1a4b0GvmXY+R+HIu4cKnKzwowBUAXj4xfiQUm2uoVAZGtfuHJwgf6iyET1u OvATZvFrXeYi/oP+k0O5/ioj2Xys0jaFNwxH6w6VHSdCw1tuvfzjCGZeBh3ArTJZmud0 ny26BkwhiOWN+p+bwe3MpnzLlgxFBsKBvsGJLVvgBmKWWcf4u1t4kOG17yIVcMS/cfsW KCkt57WnINx3phnZq0V4XEvgVyeaC+cwj5dJDIV3ic6hhSfBe5/ZNSXDDJjCNUwMaVkE PKfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qfyRPgQZqNWOmMmZUBNoG+a8v7OPabSQK1leZNajt2g=; b=ufvDT2BXz3S56CtpJp3cVPVJLpzCOGT2xj4YytOGWWKYpSVLRUwQyWWlY/LOPFEIhG iIDMXvfI5VnFU1EYj/+3OqzruemphTv8Apl/QuXpd6cAvOJQUNdPR+0flZd7G5M6rz+Q udgF6FitSJhIg8NG5lwphkeqCbIhiMA3Gv88CvjsnuMLMWn0+xorI6qfsQQXqpvUbfP9 4dd2+3mdxXyULbjXFXxsCQYx0OrnUhfxlyaKErAuMuwTNgDRgaBvYN7AKGjZ+IBtw7mY t6tB4v0zmhVTJWBo6wSHVf9k48c94C3ArQN200h34KWuHSkb8Ts0tbWOYF2S/Pda25BG dShg== X-Gm-Message-State: AOAM5315ZOGZOfElgB58Obqx9ZFLQr7ephrAao/mOrbTa2JUUGq2wxWn 6NnjP2Jwz0F24GINqMWA9kn7uWdz3u2vCQ== X-Received: by 2002:adf:e804:0:b0:1ea:9c3b:8f41 with SMTP id o4-20020adfe804000000b001ea9c3b8f41mr1759262wrm.53.1645543423398; Tue, 22 Feb 2022 07:23:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id g16-20020a7bc4d0000000b0037bbe255339sm2687403wmk.15.2022.02.22.07.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 07:23:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 0/2] block/curl: check error return from curl_easy_setopt() Date: Tue, 22 Feb 2022 15:23:39 +0000 Message-Id: <20220222152341.850419-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::434 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=no 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: , Cc: Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Coverity points out that we aren't checking the return value from curl_easy_setopt() for any of the calls to it we make in block/curl.c. Tested with 'make check' and with some basic smoke test command lines suggested by Dan: qemu-img info https://cloud.debian.org/images/cloud/buster/daily/latest/debian-10-nocloud-amd64-daily.qcow2 qemu-img info --image-opts driver=qcow2,file.driver=https,file.url=https://cloud.debian.org/images/cloud/buster/daily/latest/debian-10-nocloud-amd64-daily.qcow2 Changes v1->v2: * new patch 1 which fixes a missing "set the error string" for when curl_init_state() returns failure, since we're about to add more cases when that function can fail * set the error string in the failure path for the direct setopt calls in curl_open() * fix the failure path in curl_setup_preadv() by putting the curl_easy_setopt() call in the same if() condition as the existing curl_multi_add_handle() thanks -- PMM Peter Maydell (2): block/curl.c: Set error message string if curl_init_state() fails block/curl.c: Check error return from curl_easy_setopt() block/curl.c | 94 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 34 deletions(-)