Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8970679ybl; Fri, 17 Jan 2020 04:17:24 -0800 (PST) X-Google-Smtp-Source: APXvYqx86Q+xWr+poRlbQbQ3mvqGtzKgVFKB+lA5k0IRtX+fI12n6WCQeKUqFIIMLg7nTOg8nu4v X-Received: by 2002:a05:6830:451:: with SMTP id d17mr5621569otc.53.1579263444365; Fri, 17 Jan 2020 04:17:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579263444; cv=none; d=google.com; s=arc-20160816; b=ZbwUsfG28qEH8t5IwQnBYPTkiYsUUIBu/QCPuA8gqKBPney/GQGyTx+dZavRhbEJkZ 0oVtvKQrAOAm4e+p4BeIbnfwa9vLuC/Tq1MgIWD9xDvxPUsbj/Xe4iPLxovPDG7AyAay CEkA/vqTub7roeoJCBHtmWVDhlyup2KOuPSeqLPB6MjuJi6YPIMYRF8GuUpCHUKRRS3P XF0+8dxSNZJI/PTmr2iv1BH9PGK2q1NtrrPI6xgSzXTqdI6XAA79n4dvr6+wB1paqlpr srG35xAaTrrHe4aNLRfP/LpsvhtcDhGbLDGUXoyqSon8SXbXfc8EHWnxMNaWwU4idPhV LUeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OLdYBE/MVxP+IEJf5xYlwkMrALul6wc+ioyfNkUWx5I=; b=LgIHQUEzTAXX8xKUYeEvLrehwv6R5WD7EmogO8eSLRA9h2DQl0lAT097DlnPWoiQ4o ih5R1u+UfhEGXEeoQD77WYvMtkBnLayxMhvezaNR5sD3Ozzttq/DD6J2wP/9H0mkoW5X 0d8KN4rtZrSQTs+zFXazDaQNs7nOiMeLzPdggp33EGDKtG5iJDhHYpSUNyHUmwJTBxUY kGfGRyL8bdnjUibANJubPv0iOydzz5fIPvGRCiybuyLKV0b8zAdU1JaNZZ+T5WQ736ov oGS3rqb9LCmD7wEnUSaJ8NEaVPhSeO5K3WK3ZeoE1mMJbGd7FNnbvw/C1tOoU0BhBIWI TBOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g7pz9kl1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8si15668163otp.13.2020.01.17.04.17.12; Fri, 17 Jan 2020 04:17:24 -0800 (PST) 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=@linaro.org header.s=google header.b=g7pz9kl1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbgAQMQR (ORCPT + 99 others); Fri, 17 Jan 2020 07:16:17 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:44433 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbgAQMQP (ORCPT ); Fri, 17 Jan 2020 07:16:15 -0500 Received: by mail-ot1-f67.google.com with SMTP id h9so22289356otj.11 for ; Fri, 17 Jan 2020 04:16:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OLdYBE/MVxP+IEJf5xYlwkMrALul6wc+ioyfNkUWx5I=; b=g7pz9kl1SZ/Rtizxe7LcT2bFiTs+MSNviUNGniWPuzf45z2CYzL4iGWTrXAGs2wWGZ EyXJFu8BIuzwBomcBYL/A+bXs32khfiabuAK2svc8iM1uDRZGHgjKn88EgfPDwX9S5X6 SDFUCbO/O9xR2SsCQ8Z5cznpog8IU9TZ9OxIw1befHw/r4+lSKAX1GGztcvA7Nyx26Kw bvahlLr5o0k1MQHyx6bPEH1u/boYopqP6Vg2/U5ijC9+y3fBL5yIgWav4qRoyPbu0abz qBsayuGbjmAupos/roG3h4teNpMMYntyCbdo+Qb0Exs0+bN+TBEGmApbtLWp96xtyIMw 0m5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OLdYBE/MVxP+IEJf5xYlwkMrALul6wc+ioyfNkUWx5I=; b=XHn8hcYyLGV9lY43JAQe7U1K6vyr1QwSCpWnSjXs1FZKqU3C3Eb1VJzgVcZ2/s4d2r sYSR5jHNEaF50MmGK60SRKYzGYxgb4/nbWppMgFlKpo38Xzo3ZavJH0OEHDnbbzAT+La ESs2Vd1sQiCEdaPJXx64m7WYbpMAKQeGUnXciMNkwBeBchwqpuFPirJkcpemwgUPq2g0 94vSOb266EPYgY37Y5Vzr3Li3hLOD/iYMDGay+ft7BPRJjDf/s03LbMa0farQiQU7zt0 v+mLkawEsMVfjSftKUdhxLyE7xM+rFRwba3o/GqMHFS8q6UmD+Hn/dhhJJmft7mr53SA RGNA== X-Gm-Message-State: APjAAAVvmFJPMiPIAtcRVHy3fTqNRDY99p/fLaXA+2Q269/AaxPfod47 zkOQfwxpJUKelgdko2KQ4rCKnZojKGx1fD9U/njWVQ== X-Received: by 2002:a9d:6e14:: with SMTP id e20mr6073905otr.283.1579263374814; Fri, 17 Jan 2020 04:16:14 -0800 (PST) MIME-Version: 1.0 References: <20200116154852.84532-1-colin.king@canonical.com> In-Reply-To: From: Jens Wiklander Date: Fri, 17 Jan 2020 13:16:03 +0100 Message-ID: Subject: Re: [PATCH][next][V2] tee: fix memory allocation failure checks on drv_data and amdtee To: "Thomas, Rijo-john" Cc: Colin King , Devaraj Rangasamy , Gary R Hook , Herbert Xu , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 17, 2020 at 7:40 AM Thomas, Rijo-john wrote: > > > > On 16/01/20 9:18 pm, Colin King wrote: > > From: Colin Ian King > > > > Currently the memory allocation failure checks on drv_data and > > amdtee are using IS_ERR rather than checking for a null pointer. > > Fix these checks to use the conventional null pointer check. > > > > Addresses-Coverity: ("Dereference null return") > > Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver") > > Signed-off-by: Colin Ian King > > Reviewed-by: Rijo Thomas Acked-by: Jens Wiklander Thanks, Jens > > Thanks, > Rijo > > > --- > > V2: update to apply against cryptodev-2.6 tree tip > > --- > > drivers/tee/amdtee/core.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c > > index be8937eb5d43..6370bb55f512 100644 > > --- a/drivers/tee/amdtee/core.c > > +++ b/drivers/tee/amdtee/core.c > > @@ -446,11 +446,11 @@ static int __init amdtee_driver_init(void) > > } > > > > drv_data = kzalloc(sizeof(*drv_data), GFP_KERNEL); > > - if (IS_ERR(drv_data)) > > + if (!drv_data) > > return -ENOMEM; > > > > amdtee = kzalloc(sizeof(*amdtee), GFP_KERNEL); > > - if (IS_ERR(amdtee)) { > > + if (!amdtee) { > > rc = -ENOMEM; > > goto err_kfree_drv_data; > > } > >