From nobody Mon Feb 9 16:56:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620249059; cv=none; d=zohomail.com; s=zohoarc; b=TSWLWW/LO4LN9kMQR2Rkq801pnnCWE5ZbH0ot7J0LB0onTN4LVhabvE3vlSUoeiN4GzuhowagnrvFHdIxUbJcEQvc6fL4r7DJ4z79eda4SFeRjTWnX3XZyJFpYi6QYvqzT1KSLV04wWb8yxsblPwu9/Q/XjlkLtsdaj4DM4FqoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620249059; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=nfSqtx2bsWJBI4JnD1Mt3pZTQzkiHMCXAS9LcMiGD6o=; b=GTaQXwYGsbwLN6333ciCZqmwn1ZYkbfBS1sfS2B+SojS/0E0hwBMJK0UW3Ge7zCMGvF3S4ZO7aqGCQtdz5kpvncePJJ4eraMENUqyO1ZgKJDuoNJ/EZtBA6LKSxiafSi0xlmAlj6zsJfvcAXpdkQ4Bw85fYGetXF+ZQppcG05YU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1620249059132466.73430145369275; Wed, 5 May 2021 14:10:59 -0700 (PDT) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-7Q_Az6ewOhCPFyiN8c-_lA-1; Wed, 05 May 2021 17:10:56 -0400 Received: by mail-wr1-f69.google.com with SMTP id 4-20020adf80040000b029010cab735fdeso1207077wrk.14 for ; Wed, 05 May 2021 14:10:56 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (astrasbourg-653-1-188-220.w90-13.abo.wanadoo.fr. [90.13.127.220]) by smtp.gmail.com with ESMTPSA id i20sm6168267wmq.29.2021.05.05.14.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 14:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620249057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nfSqtx2bsWJBI4JnD1Mt3pZTQzkiHMCXAS9LcMiGD6o=; b=iup9TjAdyCmwZUIom/ewF1sem1FUDPYCdrolUTBgkJbblT6emIJVprqHUzL+qHolnyQTyf 5uwSE1aSTu15/LtGpN8kJCfFoTEgui8fJl5EiSaWaJeoSIkWdewHvpKZ41uq0AIWYIvS/e xxw6KEDgupM5cZRq+vjfN2UPUxYv1T0= X-MC-Unique: 7Q_Az6ewOhCPFyiN8c-_lA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nfSqtx2bsWJBI4JnD1Mt3pZTQzkiHMCXAS9LcMiGD6o=; b=lXJzxAe6FfYi1jJO5Z2cQe8QA9ky1Z/9c3tg4IVsUPnR4VHoQL5+5Zgy9+fsKJ9qn+ NdAxq15cTD7mrLz+6+Xkxl3oGhyn2/8pzQIHMjrUWgV5IGqEXFXprsZ+NOoH0Lep3c0V lRUtzIc+mz08tqqMgdWy4xj5+P6ioV35aemoNrLVsfe5831OHsvrJD+dgkHj/tKfrAlH Cx9IrzsiXzjTJjyV5n0BdXPTI7GQVNWhxMlZAyQ9tIwocvX/q1576PEO6GvHb0f7uZiz 3gT+2fXfscqPI0n8N5ccGKxP+EpsCkBGN+wsh2ZjQybMp8ai4+zPEi64xJwldz6LNX0O r+bw== X-Gm-Message-State: AOAM530O7F2zSiAuRgNKwqga3UZqBD87ttJzb3h68N1eo7RTiz80t0Us O9EjIiBVSGDCj1lKcHfBjkjpy8Lks6PTTl97tKDcVP7CbDjY4tAF8TAbEHFThsM65aQDRy4n3tS CLlZFk7f0UD8QZA== X-Received: by 2002:a5d:4e52:: with SMTP id r18mr1005298wrt.179.1620249055022; Wed, 05 May 2021 14:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdcO6k4STJUW002h/z1xwQnLLkjuTPTZ/XOg80aMMNDfDaqPBnBBRL5M9D/HGhVmHgmwSWKQ== X-Received: by 2002:a5d:4e52:: with SMTP id r18mr1005281wrt.179.1620249054847; Wed, 05 May 2021 14:10:54 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-ppc@nongnu.org, Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Kevin Wolf , Max Reitz Subject: [PATCH 01/23] block/vpc: Avoid dynamic stack allocation Date: Wed, 5 May 2021 23:10:25 +0200 Message-Id: <20210505211047.1496765-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505211047.1496765-1-philmd@redhat.com> References: <20210505211047.1496765-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- block/vpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 17a705b482a..9ed144331fd 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -509,7 +509,7 @@ static inline int64_t get_image_offset(BlockDriverState= *bs, uint64_t offset, miss sparse read optimization, but it's not a problem in terms of correctness. */ if (write && (s->last_bitmap_offset !=3D bitmap_offset)) { - uint8_t bitmap[s->bitmap_size]; + g_autofree uint8_t *bitmap =3D g_malloc(s->bitmap_size); int r; =20 s->last_bitmap_offset =3D bitmap_offset; @@ -556,7 +556,7 @@ static int64_t alloc_block(BlockDriverState *bs, int64_= t offset) int64_t bat_offset; uint32_t index, bat_value; int ret; - uint8_t bitmap[s->bitmap_size]; + g_autofree uint8_t *bitmap =3D g_malloc(s->bitmap_size); =20 /* Check if sector_num is valid */ if ((offset < 0) || (offset > bs->total_sectors * BDRV_SECTOR_SIZE)) { --=20 2.26.3