From patchwork Mon Aug 13 10:02:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wang yanqing X-Patchwork-Id: 1313041 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4FF4F3FC81 for ; Mon, 13 Aug 2012 14:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752480Ab2HMOFS (ORCPT ); Mon, 13 Aug 2012 10:05:18 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:46675 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751586Ab2HMOFQ (ORCPT ); Mon, 13 Aug 2012 10:05:16 -0400 Received: by yenl14 with SMTP id l14so1937671yen.19 for ; Mon, 13 Aug 2012 07:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; bh=9E9XWUX7OIzoMy08eOhvtYlfjmbRMCPh1PckObjrCtU=; b=SSgHifC7DuYtncaXrKwK1974RAS5IVN19O/inxeTI8UpcCjpM7Qk+lFgNhy9MsGJOB S8QG6rieH1WCK2hc7Y3exDvzufwkQ93oDHrHLPbxmokA6ChCl+APY6qXp7E4nyV0JU1j LjsN30VcP4zoM8olHBQpGqkd4RgVwODNngpO9a4O1J0dpnJx2ARKkRz+MxdNcGaWzYaj KwjyOwKdCucSLcEU9Rc1z+LaBgTT6vSihaKLvsrb63gJvZXYQN7/x6fhGmCH+I6xnOGj +Ju4lIe4lWgdcnfuSRN55QimVbbT0M8e1R29U6Em8cv0ENzVZWnnehcWZGErOQBiKUMM jUtg== Received: by 10.68.200.98 with SMTP id jr2mr18776346pbc.81.1344866715726; Mon, 13 Aug 2012 07:05:15 -0700 (PDT) Received: from udknight.localhost ([120.42.74.35]) by mx.google.com with ESMTPS id ox5sm2271210pbc.75.2012.08.13.07.05.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Aug 2012 07:05:15 -0700 (PDT) Received: from udknight.localhost (udknight.localhost [127.0.0.1]) by udknight.localhost (8.14.4/8.14.4) with ESMTP id q7DA2cvb016405; Mon, 13 Aug 2012 18:02:39 +0800 Received: (from root@localhost) by udknight.localhost (8.14.4/8.14.4/Submit) id q7DA2WQ9016395; Mon, 13 Aug 2012 18:02:32 +0800 Date: Mon, 13 Aug 2012 18:02:32 +0800 From: Wang YanQing To: FlorianSchandinat@gmx.de Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, spock@gentoo.org Subject: [PATCH] video:uvesafb: check the return value of kzalloc Message-ID: <20120813100232.GA16363@udknight> Mail-Followup-To: Wang YanQing , FlorianSchandinat@gmx.de, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, spock@gentoo.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Michal maybe forgot it merely, we should add code to check the return value of kzalloc to make the code more robust. Signed-off-by: Wang YanQing --- drivers/video/uvesafb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index b0e2a42..2f8f82d 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c @@ -659,6 +659,8 @@ static int __devinit uvesafb_vbe_getedid(struct uvesafb_ktask *task, task->t.flags = TF_BUF_RET | TF_BUF_ESDI; task->t.buf_len = EDID_LENGTH; task->buf = kzalloc(EDID_LENGTH, GFP_KERNEL); + if (!task->buf) + return -ENOMEM; err = uvesafb_exec(task);