All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Michal Wilczynski <m.wilczynski@samsung.com>
Cc: drew@pdp7.com, guoren@kernel.org, wefu@redhat.com,
	ulf.hansson@linaro.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH v1] firmware: thead: Fix buffer overflow and use standard endian macros
Date: Thu, 26 Mar 2026 11:42:37 +0300	[thread overview]
Message-ID: <acTxfcRffVT6SuBm@stanley.mountain> (raw)
In-Reply-To: <20250403131051.1097423-1-m.wilczynski@samsung.com>

On Thu, Apr 03, 2025 at 03:10:51PM +0200, Michal Wilczynski wrote:
> Addresses two issues in the TH1520 AON firmware protocol driver:
> 
> 1. Fix a potential buffer overflow where the code used unsafe pointer
>    arithmetic to access the 'mode' field through the 'resource' pointer
>    with an offset. This was flagged by Smatch static checker as:
>    "buffer overflow 'data' 2 <= 3"
> 
> 2. Replace custom RPC_SET_BE* and RPC_GET_BE* macros with standard
>    kernel endianness conversion macros (cpu_to_be16, etc.) for better
>    portability and maintainability.
> 
> The functionality was re-tested with the GPU power-up sequence,
> confirming the GPU powers up correctly and the driver probes
> successfully.
> 
> [   12.702370] powervr ffef400000.gpu: [drm] loaded firmware
> powervr/rogue_36.52.104.182_v1.fw
> [   12.711043] powervr ffef400000.gpu: [drm] FW version v1.0 (build
> 6645434 OS)
> [   12.719787] [drm] Initialized powervr 1.0.0 for ffef400000.gpu on
> minor 0
> 
> Fixes: e4b3cbd840e5 ("firmware: thead: Add AON firmware protocol driver")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/17a0ccce-060b-4b9d-a3c4-8d5d5823b1c9@stanley.mountain/
> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
> ---

This is nice.

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Michal Wilczynski <m.wilczynski@samsung.com>
Cc: drew@pdp7.com, guoren@kernel.org, wefu@redhat.com,
	ulf.hansson@linaro.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH v1] firmware: thead: Fix buffer overflow and use standard endian macros
Date: Thu, 26 Mar 2026 11:42:37 +0300	[thread overview]
Message-ID: <acTxfcRffVT6SuBm@stanley.mountain> (raw)
In-Reply-To: <20250403131051.1097423-1-m.wilczynski@samsung.com>

On Thu, Apr 03, 2025 at 03:10:51PM +0200, Michal Wilczynski wrote:
> Addresses two issues in the TH1520 AON firmware protocol driver:
> 
> 1. Fix a potential buffer overflow where the code used unsafe pointer
>    arithmetic to access the 'mode' field through the 'resource' pointer
>    with an offset. This was flagged by Smatch static checker as:
>    "buffer overflow 'data' 2 <= 3"
> 
> 2. Replace custom RPC_SET_BE* and RPC_GET_BE* macros with standard
>    kernel endianness conversion macros (cpu_to_be16, etc.) for better
>    portability and maintainability.
> 
> The functionality was re-tested with the GPU power-up sequence,
> confirming the GPU powers up correctly and the driver probes
> successfully.
> 
> [   12.702370] powervr ffef400000.gpu: [drm] loaded firmware
> powervr/rogue_36.52.104.182_v1.fw
> [   12.711043] powervr ffef400000.gpu: [drm] FW version v1.0 (build
> 6645434 OS)
> [   12.719787] [drm] Initialized powervr 1.0.0 for ffef400000.gpu on
> minor 0
> 
> Fixes: e4b3cbd840e5 ("firmware: thead: Add AON firmware protocol driver")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/17a0ccce-060b-4b9d-a3c4-8d5d5823b1c9@stanley.mountain/
> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
> ---

This is nice.

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


  reply	other threads:[~2026-03-26  8:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250403131056eucas1p16076c6e4dce1f1217dc327250c419e37@eucas1p1.samsung.com>
2025-04-03 13:10 ` [PATCH v1] firmware: thead: Fix buffer overflow and use standard endian macros Michal Wilczynski
2025-04-03 13:10   ` Michal Wilczynski
2026-03-26  8:42   ` Dan Carpenter [this message]
2026-03-26  8:42     ` Dan Carpenter
2026-03-26 19:14   ` Drew Fustini
2026-03-26 19:14     ` Drew Fustini
2026-03-27 12:15     ` Michal Wilczynski
2026-03-27 12:15       ` Michal Wilczynski
2026-03-31 16:02       ` Ulf Hansson
2026-03-31 16:02         ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acTxfcRffVT6SuBm@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=drew@pdp7.com \
    --cc=guoren@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=m.wilczynski@samsung.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wefu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.