Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61F94606A31A for ; Tue, 1 Dec 2026 00:33:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=UpZSFOZv Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C22A740289; Tue, 1 Dec 2026 01:33:34 +0100 (CET) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mails.dpdk.org (Postfix) with ESMTPS id 3950A40285 for ; Tue, 1 Dec 2026 01:33:33 +0100 (CET) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-8b58d6f67a5so5488837b3a.2 for ; Mon, 30 Nov 2026 16:33:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1796085211; x=1796690011; darn=dpdk.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ifm0A+guh5Px9jtrXfxtokhFB/TzdjHVrbB2zU9Pido=; b=UpZSFOZv6n7aTKHO+2pcUyvjsq17gpecVve793LcXuaqZ2KocK5gyTWvF9odBXXVGc F7ee+9u5WFPK0u/JI+fgW73oJayB4NY1E20hbVRYoW27m0BmYmEIRBGdyPCR9aKpI6Hm ncecs83oNsaCm4LwwnsMihOpE4szLg85COgWblDdIHf+PigP/EjIJt9Hwv+SBBmXdspA yZzMh1hmcaUXdEnRJkK1WtqvKGfw62KOX16oRbR6MBl8ZbbCs9RXZ2laJ3fA05VEIsZO vftpKfLIvaEMHZ4yGce6enKMxZujGMNyzY/pbV7DY4ipSmh9s5Y48F3U6zRBkchnf/kN EDTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796085211; x=1796690011; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ifm0A+guh5Px9jtrXfxtokhFB/TzdjHVrbB2zU9Pido=; b=Dr/nAhUY43BBlKyEGA1yceS7taYZ/F84vE126ySnEByhSfV0DfbT33nRMGfmCxjupn V8D2uS1rOxekOU7vWZIdDxO8+DfOIW6wg0baKrmYdMyXMjBZe37l/7QQLTIQmOkHhzbh pPgTkrw2He4zscBLTztgSyf0sXoUhXFKz9KelMXnOhKp0ejF5NY0Xl8KKUaDiJzwZRal lmUg/0s3303U9wBaBH0bYX2bjzloAyPp5XYW/TxuBTq2pUPUop2cAnxcFpCXEuU1Qv3C AXimTe2ijLkdBM7+AgmKWenodEqKCU9ye8FQWkRyyZ8c2vvPBZ4i4WWjV4IegrViTZ4g /1MQ== X-Gm-Message-State: APuU4Z+GLOM4E4YU+d/M0r+MD5ibk65IzQQkDk7E5uzesXSwQnbjQe5N eOD9td28rE9arUjUbmmdVRFPJX0c2wLloE1aYdE5Br0fVGBc7kCD7vdFrucB+Jq/xpY= X-Gm-Gg: AZFdTZfVIZqVodDC1fCQiKBjBxU4sjajoGWha7FkNoiru7w6bLoseeafhVn4GXKUdGN oRC4FSTg+Ts9VjxBpAvsTBRkUM5ajjSUrjdCGFx5kBo59Vv3aV76uPSp+crdAG4gLSMixUwahbg QSrvAsLeFdqZzBcr/aRBOzDhrOHjedDnOzRUa7AXkEEao2ANo8Sv+OUxTgZGomLcjYFrM3bg4bN p1wp6Pf6HLi3G7SscbNTSy9G/RqVK5QstGsIKiE83OSCPe3NHUTfnP87YRrzd7hHsgWrDNWIIz+ 0sCnAptCBDt+m2BdcwfVar6rNZJ7hEtYybaX3H40IHVCf8PXW7jDZ5wptNd811CVctoR5TC0n6l gt6DgfH/D5A36dROHh8WneTha7AT8GShH3/049/zUmV3KjW8jDzz9tqZFosXfb3oNIQopCdnekz 6U3CuiXSlRXILTCmjhZ/0JLaAspFMx/q6hP2h+c8tcEZ7ugq36/Y6GvV2IwD0GwHdlNRLEYmzKY +UZSB/W8LAQwEes5qlo/i63b9tUYp8LzzWEFLtfTchNMhuNRKtFqpKq3Svo97THjqYmP1IOr5Y/ EIyMUQvIkiL6ZLcTqy4TD07R2Z/VjP+kPUBv+PfOaHeng6nLkVSpqPIaj1cEucU/txasNSs= X-Received: by 2002:a05:6a20:7d9b:b0:3e0:ba43:3d3d with SMTP id adf61e73a8af0-4014a46fca9mr7479409637.9.1796085211309; Mon, 30 Nov 2026 16:33:31 -0800 (PST) Received: from phoenix.local (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cde6d0332bfsm19058556a12.22.2026.11.30.16.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 16:33:31 -0800 (PST) Date: Mon, 30 Nov 2026 16:33:29 -0800 From: Stephen Hemminger To: Junlong Wang Cc: dev@dpdk.org Subject: Re: [PATCH v1 0/2] net/zxdh: fix issues reported by GCC analyzer Message-ID: <20261130163329.21e9eb28@phoenix.local> In-Reply-To: <20261128040458.3967016-1-wang.junlong1@zte.com.cn> References: <20261128040458.3967016-1-wang.junlong1@zte.com.cn> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Sat, 28 Nov 2026 12:04:56 +0800 Junlong Wang wrote: > Two memory safety issues in the zxdh driver, both found with > gcc -fanalyzer: > > - zxdh_get_res_info() copies a reply length taken from the device into > a caller buffer whose size it is not told. Both callers pass a > one-byte object, so an oversized length overwrites their stack, and > a length above the receive buffer size also overruns that buffer > (patch 1). > - fd_flow_parse_pattern() and fd_flow_parse_action() allocate a flow > entry when rte_flow_validate() passes dh_flow as NULL, and free it > on only one exit, so every validate leaks memory (patch 2). > > Junlong Wang (2): > net/zxdh: bound resource table reply length before copying > net/zxdh: avoid leaking flow entry on validation > > drivers/net/zxdh/zxdh_common.c | 24 ++++++++++---- > drivers/net/zxdh/zxdh_flow.c | 58 ++++++++++------------------------ > 2 files changed, 33 insertions(+), 49 deletions(-) > Applied both to next-net and fixed the commit tag AI complained about. You might want to look at the other Info: finding. Review: [PATCH v1 0/2] net/zxdh: GCC analyzer fixes Series applies cleanly to main (27.03-rc0) and builds with -Dwerror=true at each commit. [PATCH v1 1/2] net/zxdh: bound resource table reply length before copying Warning: Fixes: hash is 10 characters; must be 12. Fixes: 6310e3976bba ("net/zxdh: get device backend infos") Info: A short reply still returns success. Both callers need exactly one byte, but a reply with len == 0 passes the new check, copies nothing, and the caller returns its initializer (reps = 0) as the panel or hash id. That is the "wrong panel or hash id" outcome the commit message says it avoids. Since both callers want an exact size, reject anything else: if (tbl_reps->len != max_len || tbl_reps->len > ZXDH_RSC_TBL_CONTENT_LEN_MAX) { or have the callers check reps_len == sizeof(reps). The new length check returns -EINVAL while every other exit from zxdh_get_res_info() returns a ZXDH_BAR_MSG_* code. Callers only test != ZXDH_BAR_MSG_OK so it works, but ZXDH_BAR_MSG_ERR_LEN already exists for this case and keeps the return convention consistent.