From patchwork Thu Aug 15 11:20:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13764662 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0F801AC88A for ; Thu, 15 Aug 2024 11:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723720812; cv=none; b=R7eg4+NUv+nv92eCmlqwF2VACkEw1/szzgDoPqUSI3BGqnQDgnnhng9I0DyIzrvGDPMR9lcjix5PI/PM2JFW1j3TmoH96tCWBPp2i4Ldoc4I7mjfRy5BOphBRcQE2/mcLpoccLheAwz7b4cPNsT0GTU/XHzPlMnkCsnrTSRm3L4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723720812; c=relaxed/simple; bh=+rx9vl+x75FoWyGwCUxTtmzERdKUHmIGH1zDEF/INZk=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=Ng9uR3SbsYAHWgblU6uy6heXo0APk4vm3CcBQYRReCE5SsUfOFcV+/AV6kB40za+EYjfuvCIN7M1Jwm17nbuHNuk9MzlXLMtsauXt6Uy/spyueP55YWKvuTWUijYEBdYDuHgf/WJnF2Fo52XItCTkwgr061OO15CI2IExPmljcM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=unxTl0kP; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="unxTl0kP" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-530e2548dfdso856455e87.1 for ; Thu, 15 Aug 2024 04:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723720809; x=1724325609; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=a5FdodYMUJlHJKuSCp9GX1nhpR2hEhWwQY2UySRkoYk=; b=unxTl0kPMZ5GO/YY+N7XNx37vViuN3aXuD7pDT5xXlKwp8vNVNVMLeoVwrFcQ/Rc1U HUh5ffJaVK9h8HsSuIkA3a91DOHROS+ZMotKXu4sfoukR9M6t8ay27aGlzslm29bjuvR MkfTNungMFwf1CvnBNGAMdtsyh9O1DziH5kYInM1rZ10f5KO+2m+EBAJ1I5Cni1cDBE2 +w3O5ZsfHHaS5DXY2riSIQEZVDpqf/M/9FIS/AtVAFgQ5NVcNFfo+/iewkLTmszO1tzP VEzfHO8yfLe4Lc5am08XU8hCq3rJXCCutTfe96Q9ZWEXX0kawsrTQQIzG7lqzYUjiPQg hk6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723720809; x=1724325609; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a5FdodYMUJlHJKuSCp9GX1nhpR2hEhWwQY2UySRkoYk=; b=aFBNLSif5x+jiIo8i/SKWZTIo3m19jmHm6ZJI5iBqbOwvPT4cEcnikkuazeem9V+LM GozfpSSWK+Tq5/eVK15KY+bjeZUIT3CsnpMuu1xSl/LHIruPO1t3+1I8Bx3X5IQFBDJ9 n75RPfeZKgaqEfU85MAw4LsgcNz2itIF+knzt/wylbN0/RiWNwwD0rYi58FBTN3S+M1c S76SktD+lSHTJ/V7bRP+9kGxhbdQcYaxryg4YlrlvFP9cd34N9zi7RDBxqaUpdckzPen QysWe6+wzz5iJDFG6dkqsVvfx8o9OjYx7kGR3TGEtiJOXyTfTX1OfvSECFWZssjj1vSM nX5Q== X-Forwarded-Encrypted: i=1; AJvYcCU7WrqL7seu/yvIBzeYFTUISmvBud0OSOpJYMX9F0biahtvXUUVIU1aTQL8dws7vt4ziMhvB51umrs/xvo=@vger.kernel.org X-Gm-Message-State: AOJu0YzV/O9ijQFoOu4arBLVOXvl0adivdWZ0NAG4WXcOEbhtHCh7iVk oFgX07XRuke8igUII+l0gWtEv7J8eA6oL1TbeVOGa57vJS1A+vLSm5tz5N60Wqw= X-Google-Smtp-Source: AGHT+IGDSlIrMpFgn/V8ura8ZIKZtXcMX3El1z5OwXZ8AzCb2FT/8bSO+SRiLiqDp5oxPLs65pOZLg== X-Received: by 2002:a05:6512:b97:b0:52e:9fe0:bee4 with SMTP id 2adb3069b0e04-532eda59e63mr3297113e87.9.1723720808603; Thu, 15 Aug 2024 04:20:08 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429e7987681sm17067555e9.0.2024.08.15.04.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 04:20:08 -0700 (PDT) Date: Thu, 15 Aug 2024 14:20:04 +0300 From: Dan Carpenter To: Pavitrakumar M Cc: Herbert Xu , "David S. Miller" , shwetar , Ruud Derwig , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] crypto: spacc - Fix uninitialized variable in spacc_aead_process() Message-ID: <74ca2a96-978d-4d22-a787-04ceaa08aff6@stanley.mountain> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0c352e73-714a-476e-8e71-eef750f22902@stanley.mountain> Smatch complains that: drivers/crypto/dwc-spacc/spacc_aead.c:1031 spacc_aead_process() error: uninitialized symbol 'ptaadsize'. This could happen if, for example, tctx->mode was CRYPTO_MODE_NULL and req->cryptlen was less than icvremove. Fixes: 06af76b46c78 ("crypto: spacc - Add SPAcc aead support") Signed-off-by: Dan Carpenter --- drivers/crypto/dwc-spacc/spacc_aead.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/crypto/dwc-spacc/spacc_aead.c b/drivers/crypto/dwc-spacc/spacc_aead.c index 3468ff605957..50ef9053fc4d 100755 --- a/drivers/crypto/dwc-spacc/spacc_aead.c +++ b/drivers/crypto/dwc-spacc/spacc_aead.c @@ -823,7 +823,7 @@ static int spacc_aead_process(struct aead_request *req, u64 seq, int encrypt) u32 dstoff; int icvremove; int ivaadsize; - int ptaadsize; + int ptaadsize = 0; int iv_to_context; int spacc_proc_len; u32 spacc_icv_offset = 0; @@ -974,8 +974,6 @@ static int spacc_aead_process(struct aead_request *req, u64 seq, int encrypt) tctx->mode == CRYPTO_MODE_NULL) { if (req->cryptlen >= icvremove) ptaadsize = req->cryptlen - icvremove; - } else { - ptaadsize = 0; } /* Calculate and set the below, important parameters From patchwork Thu Aug 15 11:20:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13764663 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CDDC7DA87 for ; Thu, 15 Aug 2024 11:20:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723720820; cv=none; b=GUTafgPbfJr+FkNGwZXXj6H5l0FA9eGXKiTjzmypjkilWJLB/2RMLnoBXpUakSmkxCn64soUIqpbHL3KHY9+HmE2zWzKNSOc9fw4sjjnhAjGeS/Dlz39RgRvEVJ0WGnoHNh+Yvdti3m2Us33JGW9IKzauj9I9brV9Sb3mpFErZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723720820; c=relaxed/simple; bh=hIFrXWK0XdYxRiVPlyn4ixXpDHLCFlIFLA/+865LQ2E=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=YZqS2Zc1ccK4lMVSuE/1sC9hYi4MCcuKUkt1vIerGdpj00LXOyC8qr6NlB+CFHVKCI+n+K4tsouZVrlJ0BZBe3JBvCvMQUT1WS4iberjo30oQScvZJRMG/lE5Uc0lh5HGn8EYZEn3fnM+z2rMt9phiji834bBEzaQINu4ZQdzwo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=r1TUk1r0; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="r1TUk1r0" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-429eb13a9ccso1674625e9.2 for ; Thu, 15 Aug 2024 04:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723720817; x=1724325617; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=nMp9NlJv/KqGuQrLAUvjlu1z67TgVJ49xEoYQUtzX1A=; b=r1TUk1r0yC8/YK1B+9+y1WTf9ZO7iXkSqlOEwth6vuqG/yXa5YlWhz1TqpYnbspf+M cYAIRoUTgNqVcoHZVb2apLbXEPhU2tvlXYpdI/nR6cVAmUI0DG55KKHFUbbSnPTTV4SE qmbcRS149qZEJ8Ds+XSoD83f7GTsEfE0cSWcO4hKyrlH2mawYJ0/kgQzeF/Wv80xnBcf /xt62l0nOksXAfxbkq/nMhGBNzNfuGADPcWXzbJby2FNQCMc50eavORMiD3wOMc4uAIV tcKaiKXW4Qg9inpgNLudB4GV0AJziUl2gA0Ln+L7sG75e/MvpTt9Ij3rFTdcW+tHJAC0 eB+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723720817; x=1724325617; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nMp9NlJv/KqGuQrLAUvjlu1z67TgVJ49xEoYQUtzX1A=; b=ILgPcFNJU7CFTZMgMh0ipkj9qfKqE7/KBhe3sULg+l06ege5znmIzQ5Oh4ZuRA/zTg jzBF8DttYoTNgHNz4pyNbIaNJlCYQw6l++BLhnVNTj5avyGes6fd2lkNHI6D4SU0IMPU FM+krKWLqWDC427IN4DxUWv9fD5A0m9wkxTzlIE+Dy9tclgxKbjs6LhikhDD2UxPnjvu JyTQ05cfMphG17QXTgODVq8wY5pQEXdOX25oRPN7oNw1WyEDoDJdc2R5uF2S/yUxo3CO tv7e01Y2awfJswo6TERKicfJI33ioZqzTXP5MGDj/pkij7VdM9Iclnyz3qOE++AFvTbb aJbA== X-Forwarded-Encrypted: i=1; AJvYcCWp9H7xHk49NNmHTt9WluSiFtsns/IZ/BKuO9tru6ghGqqDAyCKfsydvk4tri6HMIjWQiDxPeStWC9lSsODxZxtpOIz8mP8Vdm1/9NA X-Gm-Message-State: AOJu0YzG0yzgCo+zRxP7APwdveLI0mw02iFS5e+7ELBzQrrku73YDZin gc2yNMinZFT3vOGCsPiEcRnQG2XPCYrETyeBqwF2sPChtXWJkNh+sUsDGQ6SbLk= X-Google-Smtp-Source: AGHT+IEUd95r2lX0qztYTlBsm265KC1oBRiSWufErk82u9C6kL44YcrfE0uhKwIok3zCaDBPYIDtWw== X-Received: by 2002:a05:6000:1971:b0:366:e7aa:7fa5 with SMTP id ffacd0b85a97d-37177756a27mr4266586f8f.1.1723720816689; Thu, 15 Aug 2024 04:20:16 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37189849a05sm1249441f8f.26.2024.08.15.04.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 04:20:16 -0700 (PDT) Date: Thu, 15 Aug 2024 14:20:12 +0300 From: Dan Carpenter To: Pavitrakumar M Cc: Herbert Xu , "David S. Miller" , shwetar , Ruud Derwig , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] crypto: spacc - Fix NULL vs IS_ERR() check in spacc_aead_fallback() Message-ID: <469138c9-8faf-4a8d-b2fe-90d0718e2788@stanley.mountain> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0c352e73-714a-476e-8e71-eef750f22902@stanley.mountain> The crypto_alloc_aead() function doesn't return NULL pointers, it returns error pointers. Fix the error checking. Fixes: 06af76b46c78 ("crypto: spacc - Add SPAcc aead support") Signed-off-by: Dan Carpenter --- drivers/crypto/dwc-spacc/spacc_aead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/dwc-spacc/spacc_aead.c b/drivers/crypto/dwc-spacc/spacc_aead.c index 50ef9053fc4d..da9df329f9d4 100755 --- a/drivers/crypto/dwc-spacc/spacc_aead.c +++ b/drivers/crypto/dwc-spacc/spacc_aead.c @@ -784,9 +784,9 @@ static int spacc_aead_fallback(struct aead_request *req, ctx->fb.aead = crypto_alloc_aead(aead_name, 0, CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_ASYNC); - if (!ctx->fb.aead) { + if (IS_ERR(ctx->fb.aead)) { pr_err("Spacc aead fallback tfm is NULL!\n"); - return -EINVAL; + return PTR_ERR(ctx->fb.aead); } subreq = aead_request_alloc(ctx->fb.aead, GFP_KERNEL); From patchwork Thu Aug 15 11:20:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13764664 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D78AB7DA72 for ; Thu, 15 Aug 2024 11:20:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723720828; cv=none; b=MFsiT/2H5dmlfY6f+wO+KECh3B+fXw1Veff+8pX7BbG0yoDZxHRc5yBHg6xYG49aTuGJNWLZwIkKFoFWGFG0nIxLg9xD095WBsF599O/+syZmWcNaQ2qB9Pwh7SSJ+M08Vo0cCKvaHEYyu/ncsBbc2I5tl0geRaRt6BdidEFrgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723720828; c=relaxed/simple; bh=HxwqfPal+HPnTS7U68L/EgIg3QGgE3PaIdmgWW1fsUI=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=fNrFxTCDUCOFST45tfBKYGB1uQJ4QZDdqlwoouyomN1xElQcoIE1e457QSFPcPBA9RWfuOcVxtYjr7+jGe/T/kyUfSKE1fKJBfJ4MboLy18STfjZHtPJNzlZYfJoiQogysilaU1JlcMDvHNKNesf6Bg7CXW567Q000BH/my92pc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hFsYbilS; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hFsYbilS" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3717de33d58so457924f8f.1 for ; Thu, 15 Aug 2024 04:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723720825; x=1724325625; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3oz0pMrv8IB6uL3g45VQLGPvoAVDEFZ62Di96CP+YN8=; b=hFsYbilSkn2+G8hqXmr5f+XljEDJuPAUaBUpv1KfN/Px+BgYc7MTg6fnw6ElAyfAMu mBZaTAfKtjXJ2FAujNegPtRvS8xo7uT8YFgFIUmtb/A+rFvURX1nP4+IVKz9tuLO06FD MHfE5npycI5q4Pf7sf4nFJCZ2pZtY+xKSmkLN5oxq3Il5685zI4WAVBcfCYuqcRi6Fbs FNISH7SF+oexHCqcIu7I/ZWyhigfM286VssbkOCu3XdteJyhsGJOP99T14K2KZ2QS+d9 oXS5XcHnISt4qELYF2Cb6tJvXtbaNLifAbCCsoB2+5B6l68+g/QvCsWPfgOmdRQwbKMa rEJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723720825; x=1724325625; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3oz0pMrv8IB6uL3g45VQLGPvoAVDEFZ62Di96CP+YN8=; b=ElVTi76+fEAhrVmpkn30kTV19D39Mof/WULDmDJDtE7pDX/2h3qIb2wjddiOs3N19+ 6IfelC4DNUTsGln4dyN1XdyoF5FTevWnwmL3284PotuY3ewbJB3gGvVRB6+9S7Bt+faR qx3J7YpN6SP6sUzShcYNO75IKy6umbzRnLmZRimircTY7TAsEC2j6//vjYKEv7BWpBzb DgVDLDOOhKKzNl/zyl06cy3vDuDWC9xHkHTKg6ntUNDQfLpS6uZcxjmZqrQng9KrGzGL r+N+4oaTsj/ileMzTZJHUbk9uxMjqZlD4JEGkwqvsvNobzKsgvOyXP059ZTXZrzVtGCd ZJKA== X-Forwarded-Encrypted: i=1; AJvYcCWief1cJ3NAdKEOp6iDK2VGEqQpA1xslO46M31fVuxi2aMO+RkIP1PpFGMrOL+KVai2ots8ir1pr2H7uzFexb9NzTsweVNMeBBltNyo X-Gm-Message-State: AOJu0Yx2Wz6Gnm8JL9Od7mj8duPn2UKj7EreqtE7JIGiy9KcK4Hfs4ss Qh72ycfscHNoLzpjL2VkwEzeDaJ9DPr+RcFskuhE3eGX9dpdF2zTBFULKIc7Xos= X-Google-Smtp-Source: AGHT+IEtSZncKJsrNhscDuBg2ooT2R3yBeExJ8WkgH59BQVHeShDTmQBJQR5acthD/BW5B0kKMMQEw== X-Received: by 2002:a5d:5f45:0:b0:367:35d7:bf11 with SMTP id ffacd0b85a97d-371777968d8mr4691884f8f.25.1723720825209; Thu, 15 Aug 2024 04:20:25 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37189897029sm1246243f8f.74.2024.08.15.04.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 04:20:24 -0700 (PDT) Date: Thu, 15 Aug 2024 14:20:20 +0300 From: Dan Carpenter To: Pavitrakumar M Cc: Herbert Xu , "David S. Miller" , Bhoomika K , Ruud Derwig , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] crypto: spacc - Check for allocation failure in spacc_skcipher_fallback() Message-ID: <2d0fd293-31a0-4116-a3ed-5e259864e561@stanley.mountain> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <0c352e73-714a-476e-8e71-eef750f22902@stanley.mountain> Check for crypto_alloc_skcipher() failure. Fixes: c8981d9230d8 ("crypto: spacc - Add SPAcc Skcipher support") Signed-off-by: Dan Carpenter --- drivers/crypto/dwc-spacc/spacc_skcipher.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/dwc-spacc/spacc_skcipher.c b/drivers/crypto/dwc-spacc/spacc_skcipher.c index 488c03ff6c36..8c698b75dd92 100644 --- a/drivers/crypto/dwc-spacc/spacc_skcipher.c +++ b/drivers/crypto/dwc-spacc/spacc_skcipher.c @@ -67,6 +67,8 @@ static int spacc_skcipher_fallback(unsigned char *name, tctx->fb.cipher = crypto_alloc_skcipher(name, CRYPTO_ALG_TYPE_SKCIPHER, CRYPTO_ALG_NEED_FALLBACK); + if (IS_ERR(tctx->fb.cipher)) + return PTR_ERR(tctx->fb.cipher); crypto_skcipher_set_reqsize(reqtfm, sizeof(struct spacc_crypto_reqctx) +