Message ID | 20230714182811.20444-2-jan@venekamp.net |
---|---|
State | Accepted |
Delegated to: | Hauke Mehrtens |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=<UNKNOWN>) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=3NCFgBBo; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R2g5q6XKHz20bh for <incoming@patchwork.ozlabs.org>; Sat, 15 Jul 2023 04:30:55 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OCloSuOiXrdUX9d9O4Q+n/2Ywhl+S1ik4mSw+2bA470=; b=3NCFgBBolpM37N 87Nyr18mdT2kOxRNO1V25MXi8Evp3BxuKhZVo9+PB8ITx7DpSHpNcYlhI8gqcpc82YgETH/iTF4IM HyaDFuTv5EjVruQmitqKXO1M5aKQ3GpZGyTHTI38jMHjEoYoM2s7y+/Zf4eKrgC/uvJyxF8lTFS/a Vmk5Xw1/eKUjIk5Ws0TEkLHcjU7YCWihHv4DxJaOHjbtZHMbbwcTHqyNWOm2dTYtoTgnoqtChqYzm rucqe504x8GAeNN+9pizpxlp+X1ghab37KpLFFTPL8GJ+jMjERDyABrd3nyNym3cXpq04yK6LvnRg sPxCxSvs31a6IR19o63w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qKNWh-006xl5-22; Fri, 14 Jul 2023 18:28:23 +0000 Received: from virt1.bvwebdesign.nl ([149.210.228.112]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qKNWa-006xiM-2W for openwrt-devel@lists.openwrt.org; Fri, 14 Jul 2023 18:28:18 +0000 Received: from localhost.localdomain (83-82-122-37.cable.dynamic.v4.ziggo.nl [83.82.122.37]) by virt1.bvwebdesign.nl (Postfix) with ESMTPSA id B753FA87219 for <openwrt-devel@lists.openwrt.org>; Fri, 14 Jul 2023 20:28:11 +0200 (CEST) From: Jan Venekamp <jan@venekamp.net> To: openwrt-devel@lists.openwrt.org Subject: [PATCH uci 1/2] file: Fix uci -m import command Date: Fri, 14 Jul 2023 20:28:10 +0200 Message-Id: <20230714182811.20444-2-jan@venekamp.net> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20230714182811.20444-1-jan@venekamp.net> References: <20230714182811.20444-1-jan@venekamp.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230714_112816_975186_9F80340A X-CRM114-Status: GOOD ( 12.29 ) X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Without this change we see the following error: # uci -m import optic < /etc/optic-db/default uci: Parse error (option/list command found before the first section) at line 4, byte 1 ptr.last is still a null pointer in case the uci_lookup_list() call found a matching section and set ptr.s to it. The code expects that uci_set() updates the ptr.last pointer, but this is not done any [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
remove internal usage of redundant uci_ptr.last
|
expand
|
diff --git a/file.c b/file.c index 93abfae..6610f53 100644 --- a/file.c +++ b/file.c @@ -459,7 +459,7 @@ static void uci_parse_config(struct uci_context *ctx) ctx->internal = !pctx->merge; UCI_NESTED(uci_set, ctx, &ptr); - pctx->section = uci_to_section(ptr.last); + pctx->section = ptr.s; } }
Without this change we see the following error: # uci -m import optic < /etc/optic-db/default uci: Parse error (option/list command found before the first section) at line 4, byte 1 ptr.last is still a null pointer in case the uci_lookup_list() call found a matching section and set ptr.s to it. The code expects that uci_set() updates the ptr.last pointer, but this is not done any more. If case uci_lookup_list() did not found a section ptr->s is a null pointer and then uci_set() will allocate a new section. Fixes: ae61e1cad4a1 ("uci: optimize update section in uci_set") Co-authored-by: Hauke Mehrtens <hmehrtens@maxlinear.com> Signed-off-by: Jan Venekamp <jan@venekamp.net> --- file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)