* [PATCH][next] drm/amd/display: fix a missing null check on a failed kzalloc
@ 2019-07-23 14:23 Colin King
2019-07-23 18:55 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-07-23 14:23 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Zhou, David Airlie, Daniel Vetter, amd-gfx, dri-devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Currently the allocation of config may fail and a null pointer
dereference on config can occur. Fix this by added a null
check on a failed allocation of config.
Addresses-Coverity: ("Dereference null return")
Fixes: c2cd9d04ecf0 ("drm/amd/display: Hook up calls to do stereo mux and dig programming to stereo control interface")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 168f4a7dffdf..7cce2baec2af 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1259,6 +1259,8 @@ bool dc_set_generic_gpio_for_stereo(bool enable,
struct gpio_generic_mux_config *config = kzalloc(sizeof(struct gpio_generic_mux_config),
GFP_KERNEL);
+ if (!config)
+ return false;
pin_info = dal_gpio_get_generic_pin_info(gpio_service, GPIO_ID_GENERIC, 0);
if (pin_info.mask == 0xFFFFFFFF || pin_info.offset == 0xFFFFFFFF) {
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] drm/amd/display: fix a missing null check on a failed kzalloc
2019-07-23 14:23 [PATCH][next] drm/amd/display: fix a missing null check on a failed kzalloc Colin King
@ 2019-07-23 18:55 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2019-07-23 18:55 UTC (permalink / raw)
To: Colin King
Cc: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Zhou, David Airlie, Daniel Vetter, amd-gfx list,
Maling list - DRI developers, kernel-janitors, LKML
On Tue, Jul 23, 2019 at 10:23 AM Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the allocation of config may fail and a null pointer
> dereference on config can occur. Fix this by added a null
> check on a failed allocation of config.
>
> Addresses-Coverity: ("Dereference null return")
> Fixes: c2cd9d04ecf0 ("drm/amd/display: Hook up calls to do stereo mux and dig programming to stereo control interface")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied. thanks!
Alex
> ---
> drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index 168f4a7dffdf..7cce2baec2af 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -1259,6 +1259,8 @@ bool dc_set_generic_gpio_for_stereo(bool enable,
> struct gpio_generic_mux_config *config = kzalloc(sizeof(struct gpio_generic_mux_config),
> GFP_KERNEL);
>
> + if (!config)
> + return false;
> pin_info = dal_gpio_get_generic_pin_info(gpio_service, GPIO_ID_GENERIC, 0);
>
> if (pin_info.mask == 0xFFFFFFFF || pin_info.offset == 0xFFFFFFFF) {
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-23 18:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 14:23 [PATCH][next] drm/amd/display: fix a missing null check on a failed kzalloc Colin King
2019-07-23 18:55 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).