From nobody Mon Apr 08 19:04:38 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VCz6b23Wcz5HYSj; Mon, 8 Apr 2024 19:04:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VCz6b0QPgz4glh; Mon, 8 Apr 2024 19:04:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712603079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bu/oGPm/GEVY85CoY+x+NsoFzO1vd89MxvzUepjyl+I=; b=x16yopMXUPP2aQO2blM8oj6msvJVwkXORZjMPfGL5PiTQ17Kj+QmcF+xyDrTuI9OiP6RBZ E8mothGmi1GM4pzZa6GvAKKFmdQIB8zrv9s8cLH+rDP4hR7KfXGCk2iVYqlfmP2U3nqGFY IUWoSX3CyY13DG06KahIPy+y5yqbXKeUSJcMzE1e8eL9ynOhH7RJGflmwjDwxtJ0S+cwEp WWIx4ZEKkXsWPe5r0LqcDlfkQZMX3iB++CIqsWReH5iNcjWJ7Tb+GOPuDt3Tr7Mh+5l/iM ZBxvvhKYYS5FLPZJ1u3GTY7km5p41ZvV6kZNLzY6J9u88DyyIabDeY4+svTt0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712603079; a=rsa-sha256; cv=none; b=oNBjVBvT+F0A7vFR6MS+UuSEpSp/evUe2AK8MjKksxxKv9WynhmUBhUYI6ksW5UybhIqC+ JwbrRUtImnp/udUNUi4D6H3JgiDRQGPzM3pSv2DoVB7y+Rp5RK7+FXxlBUH5j/aLeFTbAw iRNG1UEL4hQ76lvz4Lp/MQqrg9WBk64sbcg3X4aaRHA17duDL15T9puF9JpCF9EoFSeUFW 4vt5OXA358PP85Y89jIZJP00vfX/h15UZCuQtgJMtvSCZwjZ5tlK37mvg3tR3tJSwSboRO t7Z2c3h+qLPeY+L4cuPqc1x1PiJmnH4z763tBDvQsYkHu2EXMp40P4zGJaBI7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712603079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bu/oGPm/GEVY85CoY+x+NsoFzO1vd89MxvzUepjyl+I=; b=dX3YC4Yq7ePsdX371ScjrXHthVB+sqnn/wSU1f9XXSZSaoC14FhA5Xk9xkqBCvwXzLgwaC fMUrKdm1CmHXtOwZ70sxBa9N4Q67cNIsQzBllcP+08GYciunIFzRqFBG0WHECqDUwQbdmv 409KA8ITWjRPpKgsdvrXixFBqjG3F7HqrlzuTi43mAClV4ai49TCN30/bWxvRVbhUwlICq gVLoB/KI9BNyyaW/V8Ba/zOyXBqEmfPpMu3BiNoZVni3Kc9WDimk+9v9QILGn0AE5nHVV8 TioNE3E7MmQ4EjUR23LwWpLeegTkkdI/bDqgOVZaCu28z9FVirtgZ3i5j8L+mw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VCz6b01mgzN1H; Mon, 8 Apr 2024 19:04:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 438J4cbv094720; Mon, 8 Apr 2024 19:04:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 438J4cZn094717; Mon, 8 Apr 2024 19:04:38 GMT (envelope-from git) Date: Mon, 8 Apr 2024 19:04:38 GMT Message-Id: <202404081904.438J4cZn094717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 794517a0f379 - stable/14 - netlink: Don't use a zero-length array List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 794517a0f3794131d79e3c9d0c12fcceb840ae80 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=794517a0f3794131d79e3c9d0c12fcceb840ae80 commit 794517a0f3794131d79e3c9d0c12fcceb840ae80 Author: John Baldwin AuthorDate: 2024-02-27 19:59:52 +0000 Commit: John Baldwin CommitDate: 2024-04-08 17:58:16 +0000 netlink: Don't use a zero-length array Define SNL_DECLARE_FIELD_PARSER* macros to create a parser that has no output attributes only input fields and use this to define the snl_donemsg_parser. This removes the need for the zero-length nla_p_donemsg[] variable. Zero length arrays are not valid in ISO C. Reviewed by: jrtc27, melifaro Differential Revision: https://reviews.freebsd.org/D43918 (cherry picked from commit 69945c49fea7ac2352c1fd7d22f70f2e3861ba81) --- sys/netlink/netlink_snl.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 7bdf5424ddf3..f8387132f78a 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -174,6 +174,18 @@ static const struct snl_hdr_parser _name = { \ #define SNL_DECLARE_PARSER(_name, _t, _fp, _np) \ SNL_DECLARE_PARSER_EXT(_name, sizeof(_t), 0, _fp, _np, NULL) +#define SNL_DECLARE_FIELD_PARSER_EXT(_name, _sz_h_in, _sz_out, _fp, _cb) \ +static const struct snl_hdr_parser _name = { \ + .in_hdr_size = _sz_h_in, \ + .out_size = _sz_out, \ + .fp = &((_fp)[0]), \ + .fp_size = NL_ARRAY_LEN(_fp), \ + .cb_post = _cb, \ +} + +#define SNL_DECLARE_FIELD_PARSER(_name, _t, _fp) \ + SNL_DECLARE_FIELD_PARSER_EXT(_name, sizeof(_t), 0, _fp, NULL) + #define SNL_DECLARE_ATTR_PARSER_EXT(_name, _sz_out, _np, _cb) \ static const struct snl_hdr_parser _name = { \ .out_size = _sz_out, \ @@ -909,14 +921,12 @@ SNL_DECLARE_PARSER(snl_errmsg_parser, struct nlmsgerr, nlf_p_errmsg, nla_p_errms #define _IN(_field) offsetof(struct nlmsgerr, _field) #define _OUT(_field) offsetof(struct snl_errmsg_data, _field) -static const struct snl_attr_parser nla_p_donemsg[] = {}; - static const struct snl_field_parser nlf_p_donemsg[] = { { .off_in = _IN(error), .off_out = _OUT(error), .cb = snl_field_get_uint32 }, }; #undef _IN #undef _OUT -SNL_DECLARE_PARSER(snl_donemsg_parser, struct nlmsgerr, nlf_p_donemsg, nla_p_donemsg); +SNL_DECLARE_FIELD_PARSER(snl_donemsg_parser, struct nlmsgerr, nlf_p_donemsg); static inline bool snl_parse_errmsg(struct snl_state *ss, struct nlmsghdr *hdr, struct snl_errmsg_data *e)