From: Shailendra Verma <shailendra.v@samung.com> To: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>, Tomi Valkeinen <tomi.valkeinen@ti.com>, linux-fbdev@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-kernel@vger.kernel.org, vidushi.koul@samsung.com Subject: [PATCH] video:fbdev:core:Allocate the memory for video mode after the validation of edid. Date: Mon, 09 Nov 2015 13:33:24 +0530 [thread overview] Message-ID: <1447056204-28445-1-git-send-email-shailendra.v@samung.com> (raw) From: Shailendra Verma <shailendra.v@samsung.com> In this function "fb_create_modedb" the memory for video mode is getting allocated before the edid validation.If the validation of edid fails then we are freeing the allocated memory for the video mode and returning. So moving the memory allocation part after the edid validation.There is no need to allocate the memory before edid validation check and freeing if validation gets failed. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> --- drivers/video/fbdev/core/fbmon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c index 47c3191..476a5fd 100644 --- a/drivers/video/fbdev/core/fbmon.c +++ b/drivers/video/fbdev/core/fbmon.c @@ -620,16 +620,16 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize, int num = 0, i, first = 1; int ver, rev; - mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); - if (mode == NULL) - return NULL; - if (edid == NULL || !edid_checksum(edid) || !edid_check_header(edid)) { - kfree(mode); return NULL; } + mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); + if (mode == NULL) + return NULL; + + ver = edid[EDID_STRUCT_VERSION]; rev = edid[EDID_STRUCT_REVISION]; -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Shailendra Verma <shailendra.v@samung.com> To: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>, Tomi Valkeinen <tomi.valkeinen@ti.com>, linux-fbdev@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-kernel@vger.kernel.org, vidushi.koul@samsung.com Subject: [PATCH] video:fbdev:core:Allocate the memory for video mode after the validation of edid. Date: Mon, 09 Nov 2015 08:15:24 +0000 [thread overview] Message-ID: <1447056204-28445-1-git-send-email-shailendra.v@samung.com> (raw) In-Reply-To: <1446205073-23830-1-git-send-email-shailendra.v@samung.com> From: Shailendra Verma <shailendra.v@samsung.com> In this function "fb_create_modedb" the memory for video mode is getting allocated before the edid validation.If the validation of edid fails then we are freeing the allocated memory for the video mode and returning. So moving the memory allocation part after the edid validation.There is no need to allocate the memory before edid validation check and freeing if validation gets failed. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> --- drivers/video/fbdev/core/fbmon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c index 47c3191..476a5fd 100644 --- a/drivers/video/fbdev/core/fbmon.c +++ b/drivers/video/fbdev/core/fbmon.c @@ -620,16 +620,16 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize, int num = 0, i, first = 1; int ver, rev; - mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); - if (mode = NULL) - return NULL; - if (edid = NULL || !edid_checksum(edid) || !edid_check_header(edid)) { - kfree(mode); return NULL; } + mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); + if (mode = NULL) + return NULL; + + ver = edid[EDID_STRUCT_VERSION]; rev = edid[EDID_STRUCT_REVISION]; -- 1.9.1
next reply other threads:[~2015-11-09 8:04 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-11-09 8:03 Shailendra Verma [this message] 2015-11-09 8:15 ` [PATCH] video:fbdev:core:Allocate the memory for video mode after the validation of edid Shailendra Verma -- strict thread matches above, loose matches on Subject: below -- 2015-11-09 8:04 Shailendra Verma 2015-11-09 8:16 ` Shailendra Verma 2015-10-30 11:37 Shailendra Verma 2015-10-30 11:49 ` Shailendra Verma
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=1447056204-28445-1-git-send-email-shailendra.v@samung.com \ --to=shailendra.v@samung.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=plagnioj@jcrosoft.com \ --cc=tomi.valkeinen@ti.com \ --cc=vidushi.koul@samsung.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: linkBe 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.