Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5236990ybl; Tue, 27 Aug 2019 01:18:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpJvrvdbzd30mOQQb4egcnvz6gg8Nl6DdV+XyxZ6LC0VtgWB4JUqv7M39gpUMtbuZ/M8eh X-Received: by 2002:a62:65c7:: with SMTP id z190mr25574359pfb.9.1566893934009; Tue, 27 Aug 2019 01:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893934; cv=none; d=google.com; s=arc-20160816; b=hj3BeUbog6AwVmd17hBV8n6uXShKqVCyx2aqWeBd6FrqArmJBzNJ0Q5nDSNBFxo3re VzVAqGummzauVDBQeHdMj01Bs4q3vDZmMWDAZHGabX35R5kS3iJajlFwQpKxrznujtwA sZ97iMW7uYZnA/6CckaUf6HEgwwVjirmdi7InBTO/Xl/r3fNV//Yml+D7DmCn4cHtI9C /7MybtLfybpu8FRrHEeg5gdqzxh3GF1h3S8qnkc1Pdrtdet3mlxQGR72eW4mXJVtDbHF t4wwrLKviQrVG150IeUPqye9XmGFaf7/fmaF7JBYLKkZevVd/bsFV1hEfTSlzBCGzwRH M/Fw== 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=jPnB+RweX4VsCUWSSuUKKKGwEb9M0VDk1Axq+XeakyI=; b=m6o2+CxoPnsSvPdv53wYnNyj4W8uqPyaNmsGnxB4UJpQCU/5XIUpoWoUJsMZk9NuT6 hTp32igULMC2JftVkhjKVLLPHA34+Doya87BIT5O0SybuR36ThjfIRi34uZK+dLvmsNi eYdE4zzsebBqrBZpjJL+F+m33LzPpItOauNqRBNIDie2qHtpCTfv+DgQYcDtM+d5RksH QBjDOfOY/bsGUviYeISeL0M/4Ag1S6EwMO4DskSbsFw6Ecj5c/w/X7Rq18b85tdCvqFp fUdz6V6bixalhlsXxrdJ0cKxs1BLCJ4f3LJM6B+9Wei4dl9EiX5Z39VCul3pagQuJmUA LubQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p1NNQ+Lx; 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 co10si2486233plb.358.2019.08.27.01.18.38; Tue, 27 Aug 2019 01:18:53 -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=p1NNQ+Lx; 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 S1730513AbfH0IRG (ORCPT + 99 others); Tue, 27 Aug 2019 04:17:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:44594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728711AbfH0HxG (ORCPT ); Tue, 27 Aug 2019 03:53:06 -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 6FD84217F5; Tue, 27 Aug 2019 07:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892386; bh=QFhZUAq6CUY2ejbNoS/Xrn+mjYw8ZHmVgo0Cfwif+tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p1NNQ+Lx54Po5O9pCpCmKos0rep1WCJ3Abi99l2E1sEnOREYOOGhj6t+svINaSq6d lIZrPb8H2i6lA/qg8jgqljdsz+1Lv4KaMcuhEO4KKaQyhl+Ayoavw6f7JPzuOyf2eB jL2N5W/Y4YHXfRvHNvgDq1s8MVWTOfA+xtCyZcQU= 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.14 10/62] st_nci_hci_connectivity_event_received: null check the allocation Date: Tue, 27 Aug 2019 09:50:15 +0200 Message-Id: <20190827072700.989331884@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@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 56f2112e0cd84..85df2e0093109 100644 --- a/drivers/nfc/st-nci/se.c +++ b/drivers/nfc/st-nci/se.c @@ -344,6 +344,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