From nobody Thu Dec 15 19:59:42 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 4NY33g0vbWz4V8DN; Thu, 15 Dec 2022 19:59:43 +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 4NY33g0Pngz468g; Thu, 15 Dec 2022 19:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671134383; 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=1SwugStC0tbD5tTY5/n7Eijula5sKqEQGnVi3uvBuOk=; b=De/82DFbwKj8kR6x8d9LOxMgouy0yuERopUQhfqb9iXQ/vvphWngigyRcWL/TgvepyER5F uEfPIHCFzOh23K8V8IKen5/0LWVw95tYuF8HW9z+Q5GsteAJ62M9EXASDVbV2QqChRaYHY rCGu0xfKzV8eTTIodYa00DKdOOX+FxsRH/WS7LhpaaZwHb5l9Z9ANEXHY2mCrGpVRLl+PN NvCtB4Aojsau+ymu0ZoGWpjR3aGyP131erUYM+omCd+9cWckqE/ru2DTaPaYOX/JbX8V2t PCeh4tiimk5JKSskWFQQpZDRnuOp7mlBiyQNPgY0G/0pSeu2/PcCeAGQp8snbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671134383; 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=1SwugStC0tbD5tTY5/n7Eijula5sKqEQGnVi3uvBuOk=; b=cLo9BV6KO4SU31XTlF+wl/KkiIk1wuky3bGuNRTkHvWFakALdoiHD8tYUyDrV/Fz3pExeZ ba95IzQAmmIMsgPnvyIZOHkKko+xo8E8dvTOPiMJbY97zwFul3BMVqPFyvpWr4Hb9QHTFy 2xy24XNHSTNLDim9xYxwmLgeE1PWz95IdA4mDJHVryF1kw5IPBvYAmE4ZP31vbusa//ipm IT/UikudmIvw/Ym0j0ci02ez8rzngD15vFwa+W3DSTsQ88zuruiLpUv7pJEzacGgxLr12a 9ET/SQmkGvu3gMOuWM1S+Ju4Ss/XxYnbhyBPQAMD/G4U6grAidEuPmQxZWDW2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671134383; a=rsa-sha256; cv=none; b=nMmwEq/vwYCCYo13COfQ2S7DlGBSaU3RbbLvxKYDWUvxmfc9/4+1arGjwQ6jawktK2kzVv GQUh5+A9YgktYalmKg8+8t6dqS+lmzM/f2Rs9AGLkwurdU2JoNpFHFN++/KQ5hDyEtFWJR K8QHHkZmB3hLQW9afQDa5hyRqDNhbeu8WDoj2tUDZ5RaOfK60Ux/CXkmeHfwoAGo2X+UcW 2FOgysG0DCq3xK6iS7I0O6XDqPt1Tkjxi9JuDKCOB8dSBAAZ9jaugSo8BCLDIhNriOpKAv a/7PrTLVn/GOaVdE/wTNAy9BiVgqeXpfS/L1KRHeAoIeGzPYvhC2dAVZF/zkrQ== 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 4NY33f6Yrvzlwv; Thu, 15 Dec 2022 19:59:42 +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 2BFJxg4B014415; Thu, 15 Dec 2022 19:59:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BFJxgkq014414; Thu, 15 Dec 2022 19:59:42 GMT (envelope-from git) Date: Thu, 15 Dec 2022 19:59:42 GMT Message-Id: <202212151959.2BFJxgkq014414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 613ced558e7d - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 613ced558e7d0575e09c9eeefe7313fdce706bc0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=613ced558e7d0575e09c9eeefe7313fdce706bc0 commit 613ced558e7d0575e09c9eeefe7313fdce706bc0 Author: Mark Johnston AuthorDate: 2022-11-18 19:06:44 +0000 Commit: Mark Johnston CommitDate: 2022-12-15 19:58:43 +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 (cherry picked from commit bd634fc733d4d00858174c4e7368c31f3cced3b5) --- 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 9488d733b90e..ab8dfeeb532b 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"); @@ -712,7 +712,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; @@ -722,7 +722,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; @@ -754,13 +754,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; @@ -771,13 +771,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; @@ -815,12 +815,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; @@ -829,7 +829,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; @@ -914,20 +914,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; }