From patchwork Tue Nov 16 11:49:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samreen X-Patchwork-Id: 327612 X-Patchwork-Delegate: tomi.valkeinen@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAGBsIAx022841 for ; Tue, 16 Nov 2010 11:54:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934302Ab0KPLyR (ORCPT ); Tue, 16 Nov 2010 06:54:17 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:46202 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933802Ab0KPLyQ (ORCPT ); Tue, 16 Nov 2010 06:54:16 -0500 Received: from dlep36.itg.ti.com ([157.170.170.91]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id oAGBsEI4008059 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Nov 2010 05:54:14 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id oAGBsCD0023200; Tue, 16 Nov 2010 05:54:12 -0600 (CST) Received: from localhost (graphicspc.apr.dhcp.ti.com [172.24.136.217]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id oAGBs9f14483; Tue, 16 Nov 2010 05:54:10 -0600 (CST) From: Samreen To: Tomi Valkeinen , linux-omap@vger.kernel.org Cc: linux-fbdev@vger.kernel.org, Samreen Subject: [PATCH v2] OMAP: DSS2: OMAPFB: Add null pointer check Date: Tue, 16 Nov 2010 17:19:07 +0530 Message-Id: <1289908147-12468-1-git-send-email-samreen@ti.com> X-Mailer: git-send-email 1.5.6.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 16 Nov 2010 11:54:18 +0000 (UTC) diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 6a704f1..4fdab8e 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c @@ -2132,8 +2132,9 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) char *str, *options, *this_opt; int r = 0; - str = kmalloc(strlen(def_mode) + 1, GFP_KERNEL); - strcpy(str, def_mode); + str = kstrdup(def_mode, GFP_KERNEL); + if (!str) + return -ENOMEM; options = str; while (!r && (this_opt = strsep(&options, ",")) != NULL) {