From: thierry.reding@gmail.com (Thierry Reding)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH] pwm: meson: fix allocation of meson_pwm_channel array
Date: Mon, 30 Apr 2018 10:34:47 +0200 [thread overview]
Message-ID: <20180430083447.GJ2484@ulmo> (raw)
In-Reply-To: <20180428212521.29328-1-martin.blumenstingl@googlemail.com>
On Sat, Apr 28, 2018 at 11:25:21PM +0200, Martin Blumenstingl wrote:
> Using the pwm-meson driver on the 32-bit SoCs causes memory corruption.
> The result are some hard-to-explain errors, for example
> devm_clk_register crashes with a NULL dereference somewhere deep in the
> common clock framework code.
> In some cases the kernel even refused to boot when any of the PWM
> controllers were enables on Meson8b.
>
> The root cause seems to be an incorrect memory size in the devm_kcalloc
> call in meson_pwm_probe. The code allocates an array of meson_pwm_channel
> structs, but the size given is the size of the meson_pwm struct (which
> seems like a small copy-and-paste error, as meson_pwm is allocated a few
> lines above).
> Even with this typo the code seemed to work fine on the 64-bit GX SoCs
> (maybe due to the structs having the same size in the compiled result,
> but I haven't checked this further).
>
> Fixes: 211ed630753d2f ("pwm: Add support for Meson PWM Controller")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
> drivers/pwm/pwm-meson.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20180430/cdaf4204/attachment.sig>
prev parent reply other threads:[~2018-04-30 8:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-28 21:25 [PATCH] pwm: meson: fix allocation of meson_pwm_channel array Martin Blumenstingl
2018-04-30 8:34 ` Thierry Reding [this message]
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=20180430083447.GJ2484@ulmo \
--to=thierry.reding@gmail.com \
--cc=linus-amlogic@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox