On Thu, Jan 09, 2025 at 09:26:56PM +0800, Zijun Hu wrote: > From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx> > > of_device_uevent_modalias() saves MODALIAS value from offset > (@env->buflen - 1), so the available buffer size should be > (sizeof(@env->buf) - @env->buflen + 1), but it uses the wrong > size (sizeof(@env->buf) - @env->buflen). > > Fix by using size of space from char '\0' inclusive which ends "MODALIAS=". I prefer to get the printf specifier change merged rather than reviewing if this is correct and doesn't introduce any new bugs. We're under utilizing the buffer by 1 byte. I doubt anyone will ever hit that and it's not any worse than if they exceed the correct size of the buffer. > > Fixes: dd27dcda37f0 ("of/device: merge of_device_uevent") > Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx> > --- > drivers/of/device.c | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-)