From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, k.kozlowski@samsung.com,
thierry.reding@gmail.com, linux-pwm@vger.kernel.org,
tomasz.figa@gmail.com, jy0922.shim@samsung.com, krzk@kernel.org
Subject: Re: [PATCH v2] pwm: samsung: fix to use lowest div for large enough modulation bits
Date: Tue, 16 Aug 2016 18:25:25 +0200 [thread overview]
Message-ID: <20160816162525.GA9249@kozik-lap> (raw)
In-Reply-To: <20160816142201.12672-1-sw0312.kim@samsung.com>
On Tue, Aug 16, 2016 at 11:22:01PM +0900, Seung-Woo Kim wrote:
> From pwm_samsung_calc_tin(), there is routine to find the lowest
> divider possible to generate lower frequency than requested one.
> But it is always possible to generate requested frequency with
> large enough modulation bits except s3c24xx, so this patch fixes
> to use lowest div for the case. This patch removes following UBSAN
> warning:
>
> UBSAN: Undefined behaviour in drivers/pwm/pwm-samsung.c:197:13
> shift exponent 32 is too large for 32-bit type 'long unsigned int'
> [...]
> [<c0670248>] (ubsan_epilogue) from [<c06707b4>] (__ubsan_handle_shift_out_of_bounds+0xd8/0x120)
> [<c06707b4>] (__ubsan_handle_shift_out_of_bounds) from [<c0694b28>] (pwm_samsung_config+0x508/0x6a4)
> [<c0694b28>] (pwm_samsung_config) from [<c069286c>] (pwm_apply_state+0x174/0x40c)
> [<c069286c>] (pwm_apply_state) from [<c0b2e070>] (pwm_fan_probe+0xc8/0x488)
> [<c0b2e070>] (pwm_fan_probe) from [<c07ba8b0>] (platform_drv_probe+0x70/0x150)
> [...]
>
> Cc: Tomasz Figa <tomasz.figa@gmail.com>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
> Changes from v1
> * Remove too complex condition, instead, just checking simple variant->bits as Krzysztof's suggestion
> * Add comment from Tomasz
>
> The UBSAN warning from ARM is reported with the patch in following link:
> https://patchwork.kernel.org/patch/9189575/
> ---
> drivers/pwm/pwm-samsung.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Best regards,
Krzysztof
WARNING: multiple messages have this Message-ID (diff)
From: k.kozlowski@samsung.com (Krzysztof Kozlowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] pwm: samsung: fix to use lowest div for large enough modulation bits
Date: Tue, 16 Aug 2016 18:25:25 +0200 [thread overview]
Message-ID: <20160816162525.GA9249@kozik-lap> (raw)
In-Reply-To: <20160816142201.12672-1-sw0312.kim@samsung.com>
On Tue, Aug 16, 2016 at 11:22:01PM +0900, Seung-Woo Kim wrote:
> From pwm_samsung_calc_tin(), there is routine to find the lowest
> divider possible to generate lower frequency than requested one.
> But it is always possible to generate requested frequency with
> large enough modulation bits except s3c24xx, so this patch fixes
> to use lowest div for the case. This patch removes following UBSAN
> warning:
>
> UBSAN: Undefined behaviour in drivers/pwm/pwm-samsung.c:197:13
> shift exponent 32 is too large for 32-bit type 'long unsigned int'
> [...]
> [<c0670248>] (ubsan_epilogue) from [<c06707b4>] (__ubsan_handle_shift_out_of_bounds+0xd8/0x120)
> [<c06707b4>] (__ubsan_handle_shift_out_of_bounds) from [<c0694b28>] (pwm_samsung_config+0x508/0x6a4)
> [<c0694b28>] (pwm_samsung_config) from [<c069286c>] (pwm_apply_state+0x174/0x40c)
> [<c069286c>] (pwm_apply_state) from [<c0b2e070>] (pwm_fan_probe+0xc8/0x488)
> [<c0b2e070>] (pwm_fan_probe) from [<c07ba8b0>] (platform_drv_probe+0x70/0x150)
> [...]
>
> Cc: Tomasz Figa <tomasz.figa@gmail.com>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
> Changes from v1
> * Remove too complex condition, instead, just checking simple variant->bits as Krzysztof's suggestion
> * Add comment from Tomasz
>
> The UBSAN warning from ARM is reported with the patch in following link:
> https://patchwork.kernel.org/patch/9189575/
> ---
> drivers/pwm/pwm-samsung.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Best regards,
Krzysztof
next prev parent reply other threads:[~2016-08-16 16:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20160802102943epcas1p3d34d2c3536a094e2e8c91568eefd7cf8@epcas1p3.samsung.com>
2016-08-02 10:16 ` [PATCH] pwm: samsung: fix to use lowest div for large enough modulation bits Seung-Woo Kim
2016-08-02 10:16 ` Seung-Woo Kim
2016-08-02 10:16 ` Seung-Woo Kim
2016-08-02 10:16 ` Seung-Woo Kim
2016-08-03 1:58 ` Joonyoung Shim
2016-08-03 1:58 ` Joonyoung Shim
2016-08-16 7:37 ` Krzysztof Kozlowski
2016-08-16 7:37 ` Krzysztof Kozlowski
2016-08-16 8:25 ` Seung-Woo Kim
2016-08-16 8:25 ` Seung-Woo Kim
2016-08-16 9:00 ` Tomasz Figa
2016-08-16 9:00 ` Tomasz Figa
2016-08-16 9:10 ` Krzysztof Kozlowski
2016-08-16 9:10 ` Krzysztof Kozlowski
2016-08-16 9:32 ` Tomasz Figa
2016-08-16 9:32 ` Tomasz Figa
2016-08-16 9:32 ` Tomasz Figa
2016-08-16 9:54 ` Seung-Woo Kim
2016-08-16 9:54 ` Seung-Woo Kim
2016-08-16 14:22 ` [PATCH v2] " Seung-Woo Kim
2016-08-16 14:22 ` Seung-Woo Kim
2016-08-16 14:22 ` Seung-Woo Kim
2016-08-16 16:25 ` Krzysztof Kozlowski [this message]
2016-08-16 16:25 ` Krzysztof Kozlowski
2016-09-05 6:53 ` Thierry Reding
2016-09-05 6:53 ` Thierry Reding
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=20160816162525.GA9249@kozik-lap \
--to=k.kozlowski@samsung.com \
--cc=jy0922.shim@samsung.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=sw0312.kim@samsung.com \
--cc=thierry.reding@gmail.com \
--cc=tomasz.figa@gmail.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.