kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: kernel-janitors@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/gma500: fix memory leak on edid
Date: Mon, 20 Mar 2017 18:30:43 +0000	[thread overview]
Message-ID: <58D01FD3.4040007@bfs.de> (raw)
In-Reply-To: <20170320175601.23149-1-colin.king@canonical.com>



Am 20.03.2017 18:56, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> edid is allocated on the call to psb_intel_sdvo_get_edid but not
> kfree'd at all, causing a memory leak.  Fix this by kfree'ing
> the edid.  (This may be null, but kfree can handle null frees).
> 
> Detected by CoverityScan, CID#1090730 ("Resource Leak")
> 
> Fixes: 5736995b473b ("gma500: Replace SDVO code with slightly modified version from i915")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/gpu/drm/gma500/psb_intel_sdvo.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/gma500/psb_intel_sdvo.c b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> index e787d376ba67..f38e6ad1ab9b 100644
> --- a/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> +++ b/drivers/gpu/drm/gma500/psb_intel_sdvo.c
> @@ -1650,6 +1650,7 @@ static bool psb_intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)
>  	edid = psb_intel_sdvo_get_edid(connector);
>  	if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL)
is the check here needed at all ?
	drm_detect_monitor_audio--> drm_find_cea_extension -->drm_find_edid_extension (will check for NULL)

I missed DRM_EDID_INPUT_DIGITAL some where ? NTL i would expected drm_detect_monitor_audio to hanle it savely.

re,
 wh

>  		has_audio = drm_detect_monitor_audio(edid);
> +	kfree(edid);
>  
>  	return has_audio;
>  }

      reply	other threads:[~2017-03-20 18:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 17:56 [PATCH] drm/gma500: fix memory leak on edid Colin King
2017-03-20 18:30 ` walter harms [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=58D01FD3.4040007@bfs.de \
    --to=wharms@bfs.de \
    --cc=colin.king@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).