Hi Marek, On Wed, 3 Nov 2021 at 17:23, Marek Behún <ka...@kernel.org> wrote: > > From: Marek Behún <marek.be...@nic.cz> > > Currently sysinfo_get_str() returns 0 if a string is filled in the > given buffer, and otherwise gives no simple mechanism to determine > actual string length. > > One implementation returns -ENOSPC if buffer is not large enough. > > Change the behaviour of the function to that of snprintf(): i.e. the > buffer is always filled in as much as possible if the string exists, and > the function returns the actual length of the string (excluding the > terminating NULL-byte). > > Signed-off-by: Marek Behún <marek.be...@nic.cz> > --- > board/google/chromebook_coral/coral.c | 13 ++++--------- > common/board_info.c | 2 +- > drivers/sysinfo/gpio.c | 2 +- > drivers/sysinfo/rcar3.c | 2 +- > drivers/sysinfo/sandbox.c | 5 +++-- > include/sysinfo.h | 16 ++++++++++++---- > lib/smbios.c | 2 +- > test/dm/sysinfo-gpio.c | 12 ++++++------ > test/dm/sysinfo.c | 12 ++++++------ > 9 files changed, 35 insertions(+), 31 deletions(-)
So how do we know if the size is too small? The string is silently truncated? I think -ENOSPC is better? [..] Regards, Simon