From patchwork Thu Jul 27 15:07:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 706995 Delivered-To: patch@linaro.org Received: by 2002:a5d:6787:0:b0:317:2194:b2bc with SMTP id v7csp406349wru; Thu, 27 Jul 2023 08:13:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlFFxMfaQgiuQRMsBkVZGUy/QCv4I6fvRGHFkRsFZJ9GIbuInjXNqlD5E+sZmUACJjhEwu2D X-Received: by 2002:a05:6102:3ca6:b0:447:5662:b9c3 with SMTP id c38-20020a0561023ca600b004475662b9c3mr998016vsv.13.1690470785596; Thu, 27 Jul 2023 08:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690470785; cv=none; d=google.com; s=arc-20160816; b=PRTXe7+VIqzVxIpmMsuhhfOVmH5Gjd4Zh7ZqYlHiBR+JRnLw1zLk8ZrU40kXxD+PDH Z3OvVTi4HGrdIXSjr2H77oznuj/wbH6EpsnTawB5ZXEDrxoMWXxHoK60Ods3kevAMJn6 Pikgx7JOALs/EMD5Vpkco77HtipSl3rfprNrQDeMmQCnu8f5WVn4JgiIP/pFNp8y1QKK tT/2mzjb2z3B3L3EbfNImFA86ZHtLR/DUtNkwODytWMcJ1L7gQ/m9/7Mp9xJeRCF7uN9 bSeSuK5uce0tTysqdQ4k4ZeWaRDArC4JzcDofMOID3m3LEkodqZnAbOJQrw+PqeE3MZs jHyg== 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=TNqurY0rUHeNdsZsiViYGt28p6dzwriboasUAovzxOw=; fh=dfePGw826NW0GIMUK/TLR4fYRTubezTBvFSAmrdMKMk=; b=qlrsGR0H3rr76q6eVO06GAAHCv+jqR8SDGs6iULcZ7bQnTGfprjNxERoyCaxmSGqLS gYE6IxiKTKBbFpxBNf9dQYa3sgBq9nBZVZL2UyAJy4ABw6FkNY22UPQgTa+opHIRh6CK lbd1dmxKwUuZ+aGKu0NhYkqx+mmGW6UfzLBdqPb90gLjyWYBTPdqE/o8YCbKThn0vVJC mmhQzqx3FphB2rpXk8OMcSVNvDETZUqAJmCGoAaL6KJy+68WHsrKUPxOAniQn6vQmj2J dDtqWvW94ihMKVaeKNNTAMeiD4GTzSMEgn6WutzrUMtmDXXQt1TPiAyzlEpjgWMdnkjw B3Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T184Cx35; 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 m46-20020ab05a71000000b00797401d2eaasi147511uad.37.2023.07.27.08.13.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jul 2023 08:13:05 -0700 (PDT) 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=T184Cx35; 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 1qP2aH-0001CE-H2; Thu, 27 Jul 2023 11:07:23 -0400 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 1qP2a8-0001BO-9I for qemu-devel@nongnu.org; Thu, 27 Jul 2023 11:07:13 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qP2a5-0000Me-J2 for qemu-devel@nongnu.org; Thu, 27 Jul 2023 11:07:10 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b9540031acso17014031fa.3 for ; Thu, 27 Jul 2023 08:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690470428; x=1691075228; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TNqurY0rUHeNdsZsiViYGt28p6dzwriboasUAovzxOw=; b=T184Cx35+AxKDV8k/Ri/jkEVjRDQu9aWHHiYvakkP9KdVg6OO3N8S/6woY44HWkFap f/28Ux0phI7omqNLVLx3FI7JIauRLxXCIO/XiibiLld/xBTehM1QHjgRxcA0wr3Omfhk DV9QeF7erNv9LYV7Qm8D6/Wm944VvhbZuLZp9eSe+5OOXmK4VH5L8TiKEB17b9fE3io6 UrZhjUcheRoHv2IC/obcicsHdAiLUBXteNf9Z45cfeYaHpmqnOIDqab+GK14YYu0ojFF vQcVoryjez/19AcdZfzvjlMScW2Rw1/c+p3Y6cniB3QWewQk24n21TKUSSrhZG+Xb0si C8Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690470428; x=1691075228; 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=TNqurY0rUHeNdsZsiViYGt28p6dzwriboasUAovzxOw=; b=RyCwgUCBVx1W4aTNVAwEG47H0d70JvOd/J7Zqm1Q+pwM0TMsNmOs4OwnLJd+vhYgKW piPo1soGMQHQRfA6NOSiTt7NIGxG6FBxxu1TFUUW4EFpzGTRw7sdC065kq0oj6CImoGT Ctkmp6bS4tiCVIx5KZzZVFtNNSj20kOrAwcOEr9dKsyMMGzYU1BHMmhvTiy2ns34MRD5 uoH3A5KcVKX2/67eZycCD9vH2mNHx0K4woKr/4lizLmoi6/9+/xOKZ4YVq3BJekyZTB6 XhmnDbThDWO3Bp+vz1JDtvL6t4yvW7+XEA6ArM2My5oPheiHJtdUlCSnkf5oyVaLDAeX lXZQ== X-Gm-Message-State: ABy/qLYgEq7LybOGIwelXwDkXRiE1pdkVpDni+TOIF/hYr+iuEsrxsf7 2n9r3jpY2YBbloaK6GIRTBQ9hdCHHKfwFBalWa4= X-Received: by 2002:a2e:88c9:0:b0:2b9:6d6e:df5c with SMTP id a9-20020a2e88c9000000b002b96d6edf5cmr1992941ljk.5.1690470427851; Thu, 27 Jul 2023 08:07:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i15-20020adffdcf000000b003145559a691sm2323498wrs.41.2023.07.27.08.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 08:07:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Ronnie Sahlberg , Paolo Bonzini , Peter Lieven , Kevin Wolf , Hanna Reitz Subject: [PATCH] block/iscsi: Document why we use raw malloc() Date: Thu, 27 Jul 2023 16:07:05 +0100 Message-Id: <20230727150705.2664464-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22c; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x22c.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=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org In block/iscsi.c we use a raw malloc() call, which is unusual given the project standard is to use the glib memory allocation functions. Document why we do so, to avoid it being converted to g_malloc() by mistake. Signed-off-by: Peter Maydell --- There aren't many uses of raw malloc() in the codebase other than third-party library sourcecode. Mostly we have a comment noting when we're doing it deliberately. --- block/iscsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/iscsi.c b/block/iscsi.c index 34f97ab6460..5640c8b5657 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1058,6 +1058,7 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, return NULL; } + /* Must use malloc(): this is freed via scsi_free_scsi_task() */ acb->task = malloc(sizeof(struct scsi_task)); if (acb->task == NULL) { error_report("iSCSI: Failed to allocate task for scsi command. %s",