From patchwork Wed Mar 28 11:46:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10312815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 868DC60325 for ; Wed, 28 Mar 2018 11:46:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70A7429DD9 for ; Wed, 28 Mar 2018 11:46:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6230629DE4; Wed, 28 Mar 2018 11:46:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3BD229DD9 for ; Wed, 28 Mar 2018 11:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751193AbeC1Lqv (ORCPT ); Wed, 28 Mar 2018 07:46:51 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52388 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbeC1Lqu (ORCPT ); Wed, 28 Mar 2018 07:46:50 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2SBV8mB037848; Wed, 28 Mar 2018 11:46:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2017-10-26; bh=1bS7Ij47NM0fyrGorQRHXL5T4Kc2BsJjRofhVFEM1vo=; b=uAjMsMLfjB6RQHhrzdIkHavUGYq1/p7dpDKfWQqFtxw6i7yF28oz1xscrxpapgQNmbhf 4tqC8Iz+HoHqqZTn6robDVsgEdwn2QAmilWNXlQa0ItF673mMf+tfv+rA/oCuexEBgv6 FjScxBorOd0o4PH2ZzGZw2nDL2d12ONMtZB72jNAdlXrFcC7z5KFbvw5J08nVXkdVpGY rT2AwMP8s3kVdYy/Fhz1WrcHVtxnt9E85e+RPR71YBFEnQxUbdwnBvtgHDhr843S9Iyf PrJXNflCPGRM1eG1qdtJYWNyxOtLTjau3HhdHaZWAtvmYEn7yIKVdDZQ+0cdgyVf7jiQ sA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2120.oracle.com with ESMTP id 2h0a8br21v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Mar 2018 11:46:48 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2SBklNZ023968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Mar 2018 11:46:47 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2SBkldt010437; Wed, 28 Mar 2018 11:46:47 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 28 Mar 2018 04:46:46 -0700 Date: Wed, 28 Mar 2018 14:46:40 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] media: dvb-core: Check for allocation failure in dvb_module_probe() Message-ID: <20180328114640.GA29050@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8845 signatures=668695 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803280121 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We should check if kzalloc() fails. Fixes: 8f569c0b4e6b ("media: dvb-core: add helper functions for I2C binding") Signed-off-by: Dan Carpenter diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index cf747d753a79..787fe06df217 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -953,6 +953,8 @@ struct i2c_client *dvb_module_probe(const char *module_name, struct i2c_board_info *board_info; board_info = kzalloc(sizeof(*board_info), GFP_KERNEL); + if (!board_info) + return NULL; if (name) strlcpy(board_info->type, name, I2C_NAME_SIZE);