From patchwork Thu Nov 9 17:49:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Limonciello, Mario" X-Patchwork-Id: 10051605 X-Patchwork-Delegate: dvhart@infradead.org 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 F0576601EA for ; Thu, 9 Nov 2017 17:49:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEBDC2AEFC for ; Thu, 9 Nov 2017 17:49:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1F782AFA0; Thu, 9 Nov 2017 17:49:24 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 7DA992AEFC for ; Thu, 9 Nov 2017 17:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752727AbdKIRtV (ORCPT ); Thu, 9 Nov 2017 12:49:21 -0500 Received: from esa5.dell-outbound.iphmx.com ([68.232.153.95]:52654 "EHLO esa5.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbdKIRtT (ORCPT ); Thu, 9 Nov 2017 12:49:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dell.com; i=@dell.com; q=dns/txt; s=smtpout; t=1510249514; x=1541785514; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=k4JdYhR914uxWWKzZRvaBYOxot3YEk6PgzNaseApR6s=; b=lDs9HscJdhe+jGO4VWfm/1rQ1DQbVmSNfsOIE7upVp8e4Cpx6Zm2bYxj Dzk/Q4a67KKy79t0FKuBdhvXljNDtlXr2qAWAj77KIZf/po7FizQ9TxPC vZfXFfJlseHGrffXaD5EkMQfj+j0v1mI0S1HHSDiJhPMnEYba7z46RmbX 0=; IronPort-PHdr: =?us-ascii?q?9a23=3Ab7smohamu15YZXeDszX9UYT/LSx+4OfEezUN459i?= =?us-ascii?q?sYplN5qZps26ZB7h7PlgxGXEQZ/co6odzbGH4+a4ASQp2tWoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7?= =?us-ascii?q?Ovr6GpLIj8Swyuu+54Dfbx9GiTe5Yr5+Ngm6oRnMvcQKnIVuLbo8xAHUqXVSYe?= =?us-ascii?q?RWwm1oJVOXnxni48q74YBu/SdNtf8/7sBMSar1cbg2QrxeFzQmLns65Nb3uhnZ?= =?us-ascii?q?TAuA/WUTX2MLmRdVGQfF7RX6XpDssivms+d2xSeXMdHqQb0yRD+v9LlgRgP2hy?= =?us-ascii?q?gbNj456GDXhdJ2jKJHuxKquhhzz5fJbI2JKPZye6XQctQGS2RBQMtdTjVNDIGh?= =?us-ascii?q?YIsVFuYPIPtYr5Llp1QQsRS+GRCgBOfoyj5Gm3T62a033+EnHA7BwAIuH8wDvG?= =?us-ascii?q?3NoNv3KagSS/m5wrTVzTXYd/NZxyvy6JTVeRwlv/2AQbd8fMzMwkctCgzFlE2d?= =?us-ascii?q?p4z7MT2I2OoDsG+V4OhuVe2thW4opB1+rDe0y8cwiYTEnJ4Zx0rY+Sh7xos+ON?= =?us-ascii?q?22SFR8Yd6hCJZesDuVN5F3QsMlXmpmvic6yrgBuZ69YCcKyYooxxrba/yAboOF?= =?us-ascii?q?5RfjW/yLITd5g3JpYra/hxe38UinzO3zSsi030hOripBldnBrW0C2ALX6siDUP?= =?us-ascii?q?dy4kCh2TOW2g3V9+pKIlg0mLLaJpMi2LI8iJQevVrZEiPrmEj7grWaels49uWm?= =?us-ascii?q?8+jrf7rrq5GGO4NpiwzzM74il8+/DOgiLwQDX2mW9OKh37P550L5Wq9Fjvgun6?= =?us-ascii?q?nct5DVONoUq7aiAw9QzoYj8xG/Dyq60NgAnXkIMlZFeBWfgof3IFHBOvD1Ae2i?= =?us-ascii?q?jFuylDdrw+nKPrr8ApXRNXfDl6rhfbBg5EJC0gYzzMhf55JRCrAOOv78RkjxtN?= =?us-ascii?q?nAAh84NQy73frnBc18244dQ26DHKGUPL3IvVOV5u8iLfOAaJEJtDvzM/Ql4uTh?= =?us-ascii?q?jX49mV8TZ6mp2p4XZWi9Hvt8OUWZYH3sjs0FEWcLuwo+S+rqh0GDUTFNY3ayW6?= =?us-ascii?q?U86yomB424CYfDQpqhj6CG3Ce+BpFWfHxJCkiQEXf0cIWJQ/MMaCOUIs98nT0I?= =?us-ascii?q?TLuhRJE71RGoqgD6z6FqLvTb+iIGr5Lvztt16PPJlRE06zN0C96R02aXT2F7hm?= =?us-ascii?q?kIXSM53LhjoUxhzVeOybB4g/hCGtxP6fNJVR06NZvFw+NnEdDyWxzBccmTSFq/?= =?us-ascii?q?TdSrAjA8Q8kvw98BfUl9Ac+ujhPd0CqwBb8aibiLCIYz8qLG0Hiib/p6nnrY1K?= =?us-ascii?q?A7k3EnRMVVPGGrj6I58BLcQ8bglUmI352qeLoX3CPL92DLmWOIsFAeSw59T67F?= =?us-ascii?q?UHYcYWPZqN344gXJSLr4Wpo9NQ4U7MeYK6wCTtzsilNNRfrnPNOWN2e4gWa3Qx?= =?us-ascii?q?KJw7SKZ4vnf2Ea9CnQDExCmAcWqyXVfTMiDzus9jqNRAdlEkjiNgazrOQ=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2E5AABblARah8uZ6ERcGQEBAQEBAQEBA?= =?us-ascii?q?QEBAQcBAQEBAYUGJ4N9ih+PJ4FWiHyNeIIRCoU7AoQ3PxgBAQEBAQEBAQEBAhA?= =?us-ascii?q?BAQEKCwkIKC+COCSCQwYjBAsBRhAlAhgOAgIhNgYBEooLAxWpcoFtOodCDYNIA?= =?us-ascii?q?QEBAQYBAQEBASOBD4IhggeBVIFpNIVhhUGCYwWSdI5qPYIxjVSEeZM7jSKJAIE?= =?us-ascii?q?5H4IqeoNCgmyCEliMCgEBAQ?= X-IPAS-Result: =?us-ascii?q?A2E5AABblARah8uZ6ERcGQEBAQEBAQEBAQEBAQcBAQEBAYU?= =?us-ascii?q?GJ4N9ih+PJ4FWiHyNeIIRCoU7AoQ3PxgBAQEBAQEBAQEBAhABAQEKCwkIKC+CO?= =?us-ascii?q?CSCQwYjBAsBRhAlAhgOAgIhNgYBEooLAxWpcoFtOodCDYNIAQEBAQYBAQEBASO?= =?us-ascii?q?BD4IhggeBVIFpNIVhhUGCYwWSdI5qPYIxjVSEeZM7jSKJAIE5H4IqeoNCgmyCE?= =?us-ascii?q?liMCgEBAQ?= Received: from esa5.dell-outbound2.iphmx.com ([68.232.153.203]) by esa5.dell-outbound.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 11:45:13 -0600 Received: from ausxippc106.us.dell.com ([143.166.85.156]) by esa5.dell-outbound2.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 23:45:04 +0600 X-LoopCount0: from 10.208.86.39 X-IronPort-AV: E=Sophos;i="5.44,370,1505797200"; d="scan'208";a="171994796" X-DLP: DLP_GlobalPCIDSS From: Mario Limonciello To: dvhart@infradead.org, Andy Shevchenko Cc: LKML , platform-driver-x86@vger.kernel.org, pali.rohar@gmail.com, Mario Limonciello Subject: [PATCH v2 1/2] platform/x86: dell-wmi-descriptor: check if memory was allocated Date: Thu, 9 Nov 2017 11:49:09 -0600 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP devm_kzalloc will return NULL pointer if no memory was allocated. This should be checked. This problem also existed when the driver was dell-wmi.c. Signed-off-by: Mario Limonciello Reviewed-by: Pali Rohár --- drivers/platform/x86/dell-wmi-descriptor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/platform/x86/dell-wmi-descriptor.c b/drivers/platform/x86/dell-wmi-descriptor.c index 3204c408e261..28ef5f37cfbf 100644 --- a/drivers/platform/x86/dell-wmi-descriptor.c +++ b/drivers/platform/x86/dell-wmi-descriptor.c @@ -121,6 +121,11 @@ static int dell_wmi_descriptor_probe(struct wmi_device *wdev) priv = devm_kzalloc(&wdev->dev, sizeof(struct descriptor_priv), GFP_KERNEL); + if (!priv) { + ret = -ENOMEM; + goto out; + } + priv->interface_version = buffer[2]; priv->size = buffer[3]; ret = 0;