Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751724AbbKIIE1 (ORCPT ); Mon, 9 Nov 2015 03:04:27 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:45607 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbbKIIEZ (ORCPT ); Mon, 9 Nov 2015 03:04:25 -0500 X-AuditID: cbfee61b-f79d56d0000048c5-83-56405385c87b From: Shailendra Verma To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org, Greg Kroah-Hartman 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 Message-id: <1447056204-28445-1-git-send-email-shailendra.v@samung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOJMWRmVeSWpSXmKPExsVy+t9jQd3WYIcwg6UL9S2aF69nszjR94HV 4vKuOWwW6x6+YLJYP/8Wm8Xfi5fYHNg8Xl24w+Kxf+4ado++LasYPY7f2M7k8XmTXABrFJdN SmpOZllqkb5dAlfGv7d5Be+5Ko4c+cjWwPiZo4uRk0NCwETi/urn7BC2mMSFe+vZQGwhgVmM Eocfl3YxcgHZrxklTi15ydzFyMHBJmAgselWAEhcRGAbo8TlUydZQBqYBawkJv2fzQpiCwuk SHw6M50ZxGYRUJV4+vsaWJxXwF2ibdVpFpA5EgIKEnMm2Uxg5F7AyLCKUSK1ILmgOCk91ygv tVyvODG3uDQvXS85P3cTIzg4nknvYDy8y/0QowAHoxIPL8N0+zAh1sSy4srcQ4wSHMxKIryH vR3ChHhTEiurUovy44tKc1KLDzFKc7AoifPqexqFCQmkJ5akZqemFqQWwWSZODilGhj5VzG4 rexlaT3135fx2wKhJ13md/psFVpjMyYH3PlSeP3/stRrkxar39i6/dt7PRnGSyv+vGO5cXVi f6ryrX+7H9yTLWCSsVcvSDuw4G7M2qX33E3+TVL8UZt09ki9PcuFUqOiZEcVpc2RPrEVd8UD /11hUbFKmL+vyiJynlCF+K5pTOf2RUxXYinOSDTUYi4qTgQA054T1AoCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1593 Lines: 48 From: Shailendra Verma 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/