[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250110174848.GA3223452-robh@kernel.org>
Date: Fri, 10 Jan 2025 11:48:48 -0600
From: Rob Herring <robh@...nel.org>
To: Zijun Hu <zijun_hu@...oud.com>
Cc: Saravana Kannan <saravanak@...gle.com>,
Maxime Ripard <mripard@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Grant Likely <grant.likely@...retlab.ca>,
Marc Zyngier <maz@...nel.org>,
Andreas Herrmann <andreas.herrmann@...xeda.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Catalin Marinas <catalin.marinas@....com>,
Mike Rapoport <rppt@...nel.org>,
Oreoluwa Babatunde <quic_obabatun@...cinc.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v4 05/14] of: Fix available buffer size calculating error
in API of_device_uevent_modalias()
On Thu, Jan 09, 2025 at 09:26:56PM +0800, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@...cinc.com>
>
> 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@...cinc.com>
> ---
> drivers/of/device.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
Powered by blists - more mailing lists