Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754373AbbLTL2x (ORCPT ); Sun, 20 Dec 2015 06:28:53 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:41224 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933112AbbLTL2f (ORCPT ); Sun, 20 Dec 2015 06:28:35 -0500 X-IronPort-AV: E=Sophos;i="5.20,454,1444687200"; d="scan'208";a="193180809" From: Julia Lawall To: Martin Schwidefsky Cc: kernel-janitors@vger.kernel.org, Heiko Carstens , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] s390/cio: add NULL test Date: Sun, 20 Dec 2015 12:15:52 +0100 Message-Id: <1450610153-7746-4-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450610153-7746-1-git-send-email-Julia.Lawall@lip6.fr> References: <1450610153-7746-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1081 Lines: 40 Add NULL test on call to kzalloc. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; identifier fld; @@ * x = kzalloc(...); ... when != x == NULL x->fld // Signed-off-by: Julia Lawall --- drivers/s390/char/con3215.c | 2 ++ 1 files changed, 2 insertions(+) diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 0fc3fe5..7d82bbc 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c @@ -922,6 +922,8 @@ static int __init con3215_init(void) spin_lock_init(&raw3215_freelist_lock); for (i = 0; i < NR_3215_REQ; i++) { req = kzalloc(sizeof(struct raw3215_req), GFP_KERNEL | GFP_DMA); + if (!req) + return -ENOMEM; req->next = raw3215_freelist; raw3215_freelist = req; } -- 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/