Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp466102ybl; Tue, 7 Jan 2020 23:55:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwvYSLoKe8QdHhIXLo6DDS8PzGDrN7MKtvqaFWLUrCDWkRIhBLch9OUT2XDgnAElcbG8c7/ X-Received: by 2002:a9d:51c1:: with SMTP id d1mr3102397oth.136.1578470117838; Tue, 07 Jan 2020 23:55:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578470117; cv=none; d=google.com; s=arc-20160816; b=AlEoL/MUxpBaEUodkzXFgaCLmb2+F7olnLde5I0dCNOjqfTQpGFHIHyhjKC5olyiRx EHZpipKiOAbTXtN0T5s8gnlQmVo6SRF6GOR2GX9firTWZk2Vw7xdrilCp14/2Xxs08bB wOFasDf9Hy7GEhOT+8tPuBGDlxtpUTH48Z+42ZHzAhpQQ1w+6Vv881EnRIScFW1cDWiz /g8aPM0ndY0YjYQ2K1i6BcgradxhsNhtWbznjIy9UuZS/5kQmF6TBfo61E4S9l1J5iBX 0t3NZ4gA4nu0ew6xC79Rom0rZrcIoU9zcE4c45QQ5n4deyssI/BwNlQpY7YNsc+lMqXs gNUQ== 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=camziUii29p0luivFHpHfiIofvd34K0/ntq20cnWejQ=; b=XKhCbeh3wTL/ICm+1aRAyBI23XX++D0Iwop4bxgUCIEVL6VniiJcYzN/9hnO8cS0+L ZqnspOZ1dTRR7VJWClvPsMNHVRa44SEeLgmu2aj5wk86n23wByZ4TvEUTWzKBX9kPtnl nB7Pt1nGKLKv4/9S/WOoq7HboYF/VgBapsfgnOJXkaRbSMPgpX9cNdGl+rL8oEEV0OI3 vHu2Q8s5MYe7syr3KYNLzR1ssevFJgg9qvIk8bNW0TKIY89HANIt48ry+rYKM9N0ObRH +T6C1XI7ewHPVlqNjYWsHbenDzBcoBY4+t12Mayik4yn/E1e+hEySUUFRyiYgJhXZA1Q 8HYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EYsjZsFA; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 d192si1321648oig.21.2020.01.07.23.54.57; Tue, 07 Jan 2020 23:55:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=EYsjZsFA; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 S1726593AbgAHHx1 (ORCPT + 99 others); Wed, 8 Jan 2020 02:53:27 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:39046 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726182AbgAHHx1 (ORCPT ); Wed, 8 Jan 2020 02:53:27 -0500 Received: by mail-oi1-f194.google.com with SMTP id a67so1864639oib.6 for ; Tue, 07 Jan 2020 23:53:26 -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=camziUii29p0luivFHpHfiIofvd34K0/ntq20cnWejQ=; b=EYsjZsFAsUzuW2XCUGVOeJWRTDpsijA5eG5WJTpjNPOKwMOlWw6m74WmBpygMw4Wal CHfd15+K/BxFl/GhaT6DN+6B6+5nGqFEgtbS87PFoKKF44WyOu59XGPLdRtdKjUOyCV6 d4aWD2Xh3x5tCfggne33yy9ezgsieutkI6AXqPXkYIZI8vMDMsimzfC5yfaslwdYKx0T KINyphhUgkHEd8YOel3atJFy5i4FBC9bCRSI7pQxWUVe7+S2BkNzWsohuJ1BDQzbpb2G 0tQY7yXDvwPrQMH6R+Cz4bfge1cUOvyUnR/n4ZfuAseGuET2OvABs6s2SHmxbtHAcQ7w Uf+A== 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=camziUii29p0luivFHpHfiIofvd34K0/ntq20cnWejQ=; b=RnyjKQ/5MlI5C0vzSgiTy/7Y+U/0GmbnN6/SebzFctVCI/AS3MQ8QIk1YOTOstyeuM fL03NMv8c3uq67SUOV6f2mSE9qcw5grwJADwkRbuJnqp0gd8pEKaOpXzAdJaTeCnZxtD b7xEOnGzmYioqDLFLF6atAIqPHWGM3Ykmc+wsejpUKLHBmYws1DcU6hb9xlqjQSzu875 LwHMR6bFZoC7yrYm2+SbKJ/AXFlOEW4Vh19GbHyCkislVMVOqr8r+aYX7XqgADyioGMZ p/kusSmCjugxEVtAAc2qPvAObc/iyOYpHVZB3qOoWCHKQ4wa9UtJ5dkkzP9TRg9d//+X aNMw== X-Gm-Message-State: APjAAAUX5TkL49uhjCXIqMwD4tRzCz6PmjxSW88SbuuPDRziIEV/txGq ilLf35DF0zWigDoBZZ8LUDD0i/Y1vUC4PLZ5T+LOZg== X-Received: by 2002:a05:6808:b37:: with SMTP id t23mr2101890oij.149.1578470006357; Tue, 07 Jan 2020 23:53:26 -0800 (PST) MIME-Version: 1.0 References: <20200107143601.105321-1-colin.king@canonical.com> <747f9c93-7465-99aa-0b91-a05fd64c7d1f@amd.com> In-Reply-To: <747f9c93-7465-99aa-0b91-a05fd64c7d1f@amd.com> From: Jens Wiklander Date: Wed, 8 Jan 2020 08:53:15 +0100 Message-ID: Subject: Re: [PATCH][next] tee: fix memory allocation failure checks on drv_data and amdtee To: "Thomas, Rijo-john" Cc: Colin King , Devaraj Rangasamy , Herbert Xu , Gary R Hook , "tee-dev @ lists . linaro . org" , "linux-crypto@vger.kernel.org" , kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Jan 8, 2020 at 8:03 AM Thomas, Rijo-john wrote: > > +linux-crypto > > On 07/01/20 8:06 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 > > > --- > > 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 9d0cee1c837f..5fda810c79dc 100644 > > --- a/drivers/tee/amdtee/core.c > > +++ b/drivers/tee/amdtee/core.c > > @@ -444,11 +444,11 @@ static int __init amdtee_driver_init(void) > > goto err_fail; > > > > 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; > > } > >