Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1034597ybe; Wed, 4 Sep 2019 11:29:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqydGJlXmzKrMiaykXTrsZaDpheQAVHM3C03KD02i+QNUQnB//RGPyADCNro4IumzKMj8/Jy X-Received: by 2002:a62:cdc3:: with SMTP id o186mr48272164pfg.168.1567621759861; Wed, 04 Sep 2019 11:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621759; cv=none; d=google.com; s=arc-20160816; b=lKlj/eTqvcWEaHfEmLJEl/FhalI3tToDt1pcM+KCQm11a/vw4lND1sPvFdkO+AEX3J dzCA99ecr11f3h04KWeTi2scOSSB/6vK7Nk/rMbCF4yaK/ew9z2QM4k1nv1Xn+kgC4JX cUlvslVImcepvvB8CWN0xi8Rs6ygeeuXs4N5ww5UwFtCd3kdTG4rMfhmUuovyKMDjVH2 3wgxh+AEbobgIfn+9xNT6/A2XclcnIpLcx/5JbWehW/nGcNPILLGhklcv5hOS9Jrr9/z v4k8FJsm/ALdieonURTL3o8m2aaC3lGmwKn9HgcXcorxgqSn/KFRMRPhv5KzHSa9QLdF lZRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y0GP1JQAAm2PIyZ6FvhIDs7ywhvvH8lHV3T3YsYVnlc=; b=pTNO9UCvuQP6mRbsb+Ym7GiEnYpVwufiXrVEP6vnJWaxXYmwUZey3UjJGKXSFmneZ7 THj3ZHntBAQMTlmPTBm3lHjyozyBxYo6Csa6JwX4Gq7BPmnhjYsG5DygRVpuWIXpJQUH IgC9Xs37NacxtSd1u671uConLUdjbZOU99bxC5pz3TdT6BkZNIVyKPf+2aTEfkKq6s69 ONVgSCmdAyPh7ALW1B+GhTra+W6PcCQwPwJ37oz+A3yJyA++Y2PYBtsam1E4cqklU537 YDfVg5U86ilDUc9J9ZqWgn4mNk0wQO5kf/kQQuLY8mMpgeFlO4Zo9r3wpsskGOwynm3H 9JMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LIHuUquo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91si14249349pld.3.2019.09.04.11.29.04; Wed, 04 Sep 2019 11:29:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LIHuUquo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732935AbfIDRzu (ORCPT + 99 others); Wed, 4 Sep 2019 13:55:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:32824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731971AbfIDRzs (ORCPT ); Wed, 4 Sep 2019 13:55:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B931422CF7; Wed, 4 Sep 2019 17:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567619748; bh=ICLMrqIUbQj8DupDoLJOo/f9NyODLHxhB1UwboeFW4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIHuUquoo+Hozx+k8kqyRPbKdIegKtD0p3VTVs/9HcMJnM9E3/5lubW4BSY+oiudo ag6/Xi/fvja6npyqk+3VKdJg0gVltmM/Czt8/zYlOmhQ4QaoZCWEsOaPY2qefHNGQk Gd1jljjZ7BWjW0AM3kPjLnYdJ8NfmWrUiOGz4Cnw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 08/77] st_nci_hci_connectivity_event_received: null check the allocation Date: Wed, 4 Sep 2019 19:52:55 +0200 Message-Id: <20190904175304.253216878@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175303.317468926@linuxfoundation.org> References: <20190904175303.317468926@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 3008e06fdf0973770370f97d5f1fba3701d8281d ] devm_kzalloc may fail and return NULL. So the null check is needed. Signed-off-by: Navid Emamdoost Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/nfc/st-nci/se.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nfc/st-nci/se.c b/drivers/nfc/st-nci/se.c index dbab722a06546..6f9d9b90ac645 100644 --- a/drivers/nfc/st-nci/se.c +++ b/drivers/nfc/st-nci/se.c @@ -346,6 +346,8 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev, transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev, skb->len - 2, GFP_KERNEL); + if (!transaction) + return -ENOMEM; transaction->aid_len = skb->data[1]; memcpy(transaction->aid, &skb->data[2], transaction->aid_len); -- 2.20.1