From nobody Fri Nov 18 19:13:04 2022 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 4NDRJJ6Nf7z4dGMh; Fri, 18 Nov 2022 19:13:04 +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 4NDRJJ4QWQz3LVC; Fri, 18 Nov 2022 19:13:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668798784; 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=mpPuoxlXuecv+qgpwGxXLB6PoyjFtV7OiC0qVO+CQ6s=; b=gfkv88G45C85klp7HYigjnhDoY5td6mt2M9K2TC5V9i7OrjbHqeeSrp1rgvS8ZkRoK+loc raeW8Q9unfgDZFlgfB9r67PO0Pql/gBrnG3XgiB2mVpIocet32YvaPt1U6DkAWiXclWgq3 3jTNLlWHvIIWcbozpFRjyS9EPWgjeE/zBbbYX7qqy80ZcFffYlp0FD7NZJAMhYNTbPz7Vf 9bvd5v70g8x377fOvu0P1oIcpnrRu6GjYoa6QkIL48D7F7aaQMtZRIgmprLlk8G33e7Q// OyWa/xUiwUfEsUotR00vRJTMexulFXOeDOKp39PFql/zKjnFygnFIMVLSnR9SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668798784; 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=mpPuoxlXuecv+qgpwGxXLB6PoyjFtV7OiC0qVO+CQ6s=; b=QML/XvlNCEjCGvhT+THx+Zru1vFW5PmwZ8O0xo8sK1JuodRYE3CJkUOldrbLlQOJnkQ+oo 5B6AUXaeWNfGbJnZOE68R56CV1HQrbBA9RdI9L/jdWzubA5xfxPYAwCKJH6y40NvbR0DI2 4FPuBQ+XJ4zxz4+Akq4elaQ1Bh+foAx2zU092TgPo0+vyosWDpQGVGdyfCcay0H3Ud1+LL xlzzuTQ16s8UtqDHVSSGZazUX6o42TrxB9CX2HCfUivKVsNwKg79NFT8Kh8UHmqRR9Tvky elnD0WyCV5gmF+uYBJzvDWMFmvpRIXu9fM3W13R+GkNZBoR0NrtTmKlbGn1Gtg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668798784; a=rsa-sha256; cv=none; b=SfueJpJNuSsxOWFrSeC7aOzP7Rdc53t8/E917/3djl3OR2ronzbg70FUL9Dja2jfLtnrks rZ0z3HN7JV/ZiYM8NxvfXtAFIN65+Z3L8fqNxSbtiYKMZgEOM3kj8inc+DqKp60xVgdLAU a1ueBWlMIEhD9YFnj51UobIg5Rqm4biNCwDwBL7cAVoZb7RaU4AtMKP1ArmTGXlRugb0Mn OVK0Xx4dYYu6ktRTitjP8lcJjv7JPCrLZfcBs+ctnZrJGxOugMhjgVJ3hbYPKRFxqQJL7z 82Dm5InQWgs/U9HDE675KuU3QzOIH4525JYaod9vLKukSSk510rsVbzZITLDxg== 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 4NDRJJ3W7JzJ2N; Fri, 18 Nov 2022 19:13:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AIJD43l001619; Fri, 18 Nov 2022 19:13:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AIJD4ew001618; Fri, 18 Nov 2022 19:13:04 GMT (envelope-from git) Date: Fri, 18 Nov 2022 19:13:04 GMT Message-Id: <202211181913.2AIJD4ew001618@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: bd634fc733d4 - main - bhyve: Address an unused parameter warning in the smbios code 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd634fc733d4d00858174c4e7368c31f3cced3b5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bd634fc733d4d00858174c4e7368c31f3cced3b5 commit bd634fc733d4d00858174c4e7368c31f3cced3b5 Author: Mark Johnston AuthorDate: 2022-11-18 19:06:44 +0000 Commit: Mark Johnston CommitDate: 2022-11-18 19:11:48 +0000 bhyve: Address an unused parameter warning in the smbios code The compiler was warning that the "size" parameter to smbios_generic_initializer() was unused. This parameter is apparently used to populate the "maximum structure size" field in the SMBIOS entry point, but we were always setting it to zero. Implement it instead in the main loop of the smbios table builder. MFC after: 2 weeks Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37294 --- usr.sbin/bhyve/smbiostbl.c | 48 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c index 075371808ca9..64ec175a543a 100644 --- a/usr.sbin/bhyve/smbiostbl.c +++ b/usr.sbin/bhyve/smbiostbl.c @@ -83,7 +83,7 @@ struct smbios_string { typedef int (*initializer_func_t)(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size); + uint16_t *n); struct smbios_template_entry { const struct smbios_structure *entry; @@ -376,7 +376,7 @@ static const struct smbios_table_type1 smbios_type1_template = { static int smbios_type1_initializer(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size); + uint16_t *n); static const struct smbios_string smbios_type1_strings[] = { { "system.manufacturer", "FreeBSD" }, /* manufacturer string */ @@ -480,7 +480,7 @@ static const struct smbios_string smbios_type4_strings[] = { static int smbios_type4_initializer( const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size); + uint16_t *n); static const struct smbios_table_type16 smbios_type16_template = { { SMBIOS_TYPE_MEMARRAY, sizeof (struct smbios_table_type16), 0 }, @@ -496,7 +496,7 @@ static const struct smbios_table_type16 smbios_type16_template = { static int smbios_type16_initializer( const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size); + uint16_t *n); static const struct smbios_table_type17 smbios_type17_template = { { SMBIOS_TYPE_MEMDEVICE, sizeof (struct smbios_table_type17), 0 }, @@ -537,7 +537,7 @@ static const struct smbios_string smbios_type17_strings[] = { static int smbios_type17_initializer( const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size); + uint16_t *n); static const struct smbios_table_type19 smbios_type19_template = { { SMBIOS_TYPE_MEMARRAYMAP, sizeof (struct smbios_table_type19), 0 }, @@ -552,7 +552,7 @@ static const struct smbios_table_type19 smbios_type19_template = { static int smbios_type19_initializer( const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size); + uint16_t *n); static struct smbios_table_type32 smbios_type32_template = { { SMBIOS_TYPE_BOOT, sizeof (struct smbios_table_type32), 0 }, @@ -567,7 +567,7 @@ static const struct smbios_table_type127 smbios_type127_template = { static int smbios_generic_initializer( const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size); + uint16_t *n); static struct smbios_template_entry smbios_template[] = { { (const struct smbios_structure *)&smbios_type0_template, @@ -609,7 +609,7 @@ static uint16_t type16_handle; static int smbios_generic_initializer(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size) + uint16_t *n) { struct smbios_structure *entry; @@ -656,13 +656,13 @@ smbios_generic_initializer(const struct smbios_structure *template_entry, static int smbios_type1_initializer(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size) + uint16_t *n) { struct smbios_table_type1 *type1; const char *guest_uuid_str; smbios_generic_initializer(template_entry, template_strings, - curaddr, endaddr, n, size); + curaddr, endaddr, n); type1 = (struct smbios_table_type1 *)curaddr; guest_uuid_str = get_config_value("uuid"); @@ -714,7 +714,7 @@ smbios_type1_initializer(const struct smbios_structure *template_entry, static int smbios_type4_initializer(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size) + uint16_t *n) { int i; @@ -724,7 +724,7 @@ smbios_type4_initializer(const struct smbios_structure *template_entry, int nstrings, len; smbios_generic_initializer(template_entry, template_strings, - curaddr, endaddr, n, size); + curaddr, endaddr, n); type4 = (struct smbios_table_type4 *)curaddr; p = curaddr + sizeof (struct smbios_table_type4); nstrings = 0; @@ -756,13 +756,13 @@ smbios_type4_initializer(const struct smbios_structure *template_entry, static int smbios_type16_initializer(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size) + uint16_t *n) { struct smbios_table_type16 *type16; type16_handle = *n; smbios_generic_initializer(template_entry, template_strings, - curaddr, endaddr, n, size); + curaddr, endaddr, n); type16 = (struct smbios_table_type16 *)curaddr; type16->xsize = guest_lomem + guest_himem; type16->ndevs = guest_himem > 0 ? 2 : 1; @@ -773,13 +773,13 @@ smbios_type16_initializer(const struct smbios_structure *template_entry, static int smbios_type17_initializer(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size) + uint16_t *n) { struct smbios_table_type17 *type17; uint64_t memsize, size_KB, size_MB; smbios_generic_initializer(template_entry, template_strings, - curaddr, endaddr, n, size); + curaddr, endaddr, n); type17 = (struct smbios_table_type17 *)curaddr; type17->arrayhand = type16_handle; @@ -817,12 +817,12 @@ smbios_type17_initializer(const struct smbios_structure *template_entry, static int smbios_type19_initializer(const struct smbios_structure *template_entry, const struct smbios_string *template_strings, char *curaddr, char **endaddr, - uint16_t *n, uint16_t *size) + uint16_t *n) { struct smbios_table_type19 *type19; smbios_generic_initializer(template_entry, template_strings, - curaddr, endaddr, n, size); + curaddr, endaddr, n); type19 = (struct smbios_table_type19 *)curaddr; type19->arrayhand = type16_handle; type19->xsaddr = 0; @@ -831,7 +831,7 @@ smbios_type19_initializer(const struct smbios_structure *template_entry, if (guest_himem > 0) { curaddr = *endaddr; smbios_generic_initializer(template_entry, template_strings, - curaddr, endaddr, n, size); + curaddr, endaddr, n); type19 = (struct smbios_table_type19 *)curaddr; type19->arrayhand = type16_handle; type19->xsaddr = 4*GB; @@ -916,20 +916,20 @@ smbios_build(struct vmctx *ctx) const struct smbios_string *strings; initializer_func_t initializer; char *endaddr; - uint16_t size; + size_t size; entry = smbios_template[i].entry; strings = smbios_template[i].strings; initializer = smbios_template[i].initializer; - err = (*initializer)(entry, strings, curaddr, &endaddr, - &n, &size); + err = (*initializer)(entry, strings, curaddr, &endaddr, &n); if (err != 0) return (err); + size = endaddr - curaddr; + assert(size <= UINT16_MAX); if (size > maxssize) - maxssize = size; - + maxssize = (uint16_t)size; curaddr = endaddr; }