Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Mar 2023 14:46:39 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 61482760a0ca - main - bhyve: Accept a variable-length string name for qemu_fwcfg_add_file.
Message-ID:  <c2fbbc8e-3abf-ceb7-9e65-a1d4a229ce33@FreeBSD.org>
In-Reply-To: <29CA9EB9-4226-4FB0-982E-A88A8BC5ACCB@freebsd.org>
References:  <202303221935.32MJZlHM019772@gitrepo.freebsd.org> <29CA9EB9-4226-4FB0-982E-A88A8BC5ACCB@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/22/23 12:44 PM, Jessica Clarke wrote:
> On 22 Mar 2023, at 19:35, John Baldwin <jhb@FreeBSD.org> wrote:
>>
>> The branch main has been updated by jhb:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=61482760a0ca198a9310d450133e9ac792b67955
>>
>> commit 61482760a0ca198a9310d450133e9ac792b67955
>> Author:     John Baldwin <jhb@FreeBSD.org>
>> AuthorDate: 2023-03-22 19:34:34 +0000
>> Commit:     John Baldwin <jhb@FreeBSD.org>
>> CommitDate: 2023-03-22 19:34:34 +0000
>>
>>     bhyve: Accept a variable-length string name for qemu_fwcfg_add_file.
>>
>>     It is illegal (UB?) to pass a shorter array to a function argument
>>     that takes a fixed-length array.  Do a runtime check for names that
>>     are too long via strlen() instead.
> 
> So, without static in there (that very weird corner of the C grammar*),
> the size is meaningless. GCC just treats this as a convention that you
> meant the size to do something for the purposes of diagnostics, but not
> semantics, so this is in fact a known, and by design, false-positive.

Humm, ok.  I'd probably still rather pacify the warning rather than
silence the warning as it finds real bugs in other places.

-- 
John Baldwin




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c2fbbc8e-3abf-ceb7-9e65-a1d4a229ce33>