From patchwork Tue Jul 24 15:37:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifeng Sun X-Patchwork-Id: 948830 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kDWmz0NU"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41ZqvH0qZyz9ryt for ; Wed, 25 Jul 2018 06:38:34 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id CB4B4DB5; Tue, 24 Jul 2018 20:38:30 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id D565CD9E for ; Tue, 24 Jul 2018 20:38:29 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f65.google.com (mail-pl0-f65.google.com [209.85.160.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 90285711 for ; Tue, 24 Jul 2018 20:38:29 +0000 (UTC) Received: by mail-pl0-f65.google.com with SMTP id s17-v6so2265230plp.7 for ; Tue, 24 Jul 2018 13:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0XlgnZNf7pXtK/wWq4Sein8JtsXzZ3Tk11ItHe9tdUI=; b=kDWmz0NUryFLSj94HGlsdcFUECvF0yo5Qw9dzB2qCnBMiVvumGjiMJ9eTzjXJlcgAi YebPcYOBrVswHs9OltT/JKG00RW6OSlW40r0TmkoRtVU57cNH7s9rHVhaso114gjp5oW X/SL9U83T+eY4eZVh+x50NbJopn/Me92zK7lmgqXejz+qS8fDWxspbhIRKeY1mZ+FKRa byw1+5WFGwa6d/ksqqklkyV9LZjDVbPknDxdrt2AWpw54IS4+VH0vqN3O9RhgoyqT1Nx 6eoK+MObekgKj66n+/KF8IojdKV2Mfndj1KZJVh/ab2MsutjtLezlUMKZY2tLnftdJgW Fdww== 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; bh=0XlgnZNf7pXtK/wWq4Sein8JtsXzZ3Tk11ItHe9tdUI=; b=NSeT4rtQKI6VY+zqWVzkjkBNHF2U37mLZ8CMQkJ7yP+LSZuoYDlM30Ta9ga8p/yARn ksWEBghtCAT/hBsw+ypyneAthh2MVsLj2CSlIxPEGeBpv+XJIUj33gKsmSntKQ36YJ7A iwrpquNzoKtQ/HKAYzvXHl49QA0e/bfztKzZM0mLYyYdzP0swUkNU8AWqGh+5zmaDw8M Cd+LYQdeyGYTzzCjW5jPppjVvv1kwCB5P3c53L8jVdlfmHEcMBtNWjuTuC1TjTtmvbOy LKuEwu/Hs2RYDmpp9U5UPAHh5UA34RYWDDOR3woHYdY3Be3kguqMH/uIPeHkZz44oeiJ LArA== X-Gm-Message-State: AOUpUlGoypf7Yw5oxhgjtNNKvohmh9scR5+549mYlCLsK/x9yzSEPxyJ DSrwBkIlHnZFrSdfazZS8zJQqTae X-Google-Smtp-Source: AAOMgpfXGcPrX+wvpywOEA46ILYpd/i1b8zM18xxTk9Kpo5zw1pT5IUYdUrXDotS71nFCXDMCuaJHA== X-Received: by 2002:a17:902:42c3:: with SMTP id h61-v6mr18294463pld.319.1532464709068; Tue, 24 Jul 2018 13:38:29 -0700 (PDT) Received: from yfsovs.eng.vmware.com ([66.170.99.2]) by smtp.gmail.com with ESMTPSA id z184-v6sm23971434pgd.83.2018.07.24.13.38.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jul 2018 13:38:28 -0700 (PDT) From: Yifeng Sun To: dev@openvswitch.org, yunz@nvidia.com, gmoodalbail@gmail.com Date: Tue, 24 Jul 2018 08:37:08 -0700 Message-Id: <1532446628-13331-1-git-send-email-pkusunyifeng@gmail.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_03_06, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] dynamic-string: Fix a bug that leads to assertion fail X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 'needed' should be size of needed memory space beyond allocated. Signed-off-by: Yifeng Sun Reported-by: Yun Zhou Reported-by: Girish Moodalbail --- lib/dynamic-string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c index 6f7b610a9908..4564e420544d 100644 --- a/lib/dynamic-string.c +++ b/lib/dynamic-string.c @@ -158,7 +158,7 @@ ds_put_format_valist(struct ds *ds, const char *format, va_list args_) if (needed < available) { ds->length += needed; } else { - ds_reserve(ds, ds->length + needed); + ds_reserve(ds, ds->allocated + needed); va_copy(args, args_); available = ds->allocated - ds->length + 1;