From: kbuild test robot Subject: [PATCH] crypto: ccp: fix eno.cocci warnings Date: Sat, 23 Sep 2017 05:35:58 +0800 Message-ID: <20170922213558.GA3023@lkp-wsm-ep2> References: <201709230544.TcZ8OD1t%fengguang.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kbuild-all@01.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Brijesh Singh , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Borislav Petkov , Herbert Xu , Gary Hook , Tom Lendacky , linux-crypto@vger.kernel.org To: Brijesh Singh Return-path: Content-Disposition: inline In-Reply-To: <20170919204627.3875-8-brijesh.singh@amd.com> Sender: kvm-owner@vger.kernel.org List-Id: linux-crypto.vger.kernel.org drivers/crypto/ccp/psp-dev.c:311:5-11: ERROR: allocation function on line 310 returns NULL not ERR_PTR on failure The various basic memory allocation functions don't return ERR_PTR Generated by: scripts/coccinelle/null/eno.cocci Fixes: 7d4ce155f344 ("crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support") CC: Brijesh Singh Signed-off-by: Fengguang Wu --- psp-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -308,7 +308,7 @@ static void *copy_user_blob(u64 __user u return ERR_PTR(-EINVAL); data = kmalloc(len, GFP_KERNEL); - if (IS_ERR(data)) + if (!data) return ERR_PTR(-ENOMEM); if (copy_from_user(data, (void __user *)(uintptr_t)uaddr, len))