Messages in this thread | | | From | Kenny Ho <> | Date | Thu, 25 May 2023 10:27:53 -0400 | Subject | Re: [PATCH] Remove hardcoded static string length |
| |
On Thu, May 25, 2023 at 5:14 AM David Laight <David.Laight@aculab.com> wrote: > > I does rather beg the question as what is in UTS_RELEASE when > it exceeds (IIRC) about 48 characters?
Thanks for the question as it made me dig deeper. UTS_RELEASE is actually capped at 64: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Makefile?#n1317 """ uts_len := 64 define filechk_utsrelease.h if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ exit 1; \ ... """
So UTS_RELEASE on its own would fit perfectly by coincidence (and it is also why UTS_RELEASE with the pre and postfix exceeds the limit.) That makes me wonder if the content / format of the version matter and looks like it sort of does by looking at when the string was introduced: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/net/rxrpc/local_object.c?id=44ba06987c0b10faa998b9324850e8a6564c714d
"The standard formulation seems to be: <project> <version> built <yyyy>-<mm>-<dd>"
That commit also confirms the size and null termination requirement.
I will create a separate patch with your suggestion.
Regards, Kenny
| |