Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp325294ybh; Wed, 18 Mar 2020 00:17:35 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvqBxHZleFbUdwspZqTD0rhuGgBpY81GMdvWowqnalI13xXqq+Q1vi9cPIuBZBaWeWNTem4 X-Received: by 2002:a05:6808:4e:: with SMTP id v14mr2170564oic.70.1584515855200; Wed, 18 Mar 2020 00:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584515855; cv=none; d=google.com; s=arc-20160816; b=HAHKa4AxaMLmMF4q63k/O+ZksjRQZ53Ef995E9EPu4pGbZlyCzH5DdMLjxE6GN72HQ t2U0etnqux4b5m7Gra/Q6EaRgw2pZqr7JeqZeUuInsrcI7JDCfXBb3tgrWQfe+vpw951 ep1RYkOLcwElrHFpFcqVAJeF6BZ9r9zDsEU3owOegZK3gkWGTtKAgzV6ffZXOj42IsWz yAhwOmv/S01nadIwZiVucyqLXfMUz1Zm+TJrv2nF2XGH24fXhFc7SrCtx6bHMHjq6mGp w0QI6mqYNTVhaqVt0/cPrEiIdRebzRz/wYGCB3/UpEcW/q0Uc6CKJWMzBRi2grLyh1yF 6cpQ== 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=xFq8ZCIAoaagUUYPh3q+Bqojfoi/xwpn0FlUttraLqI=; b=mQGGUPeUTu6VuTMpc+m+G/sWnYStmX+4rK8pSECLQ3BJAeRW5zf1XPU1QUvGS0fREj ItDKlnMUQqQcFYcJFCENs8v5qFXy/Ga1QZA2rIWYYGeuzevTxV+wsuFIDMKWsLlTVkB5 Ba1hl7IzvdvSOHYkHtDtmSKYcLChXTlt0lGUbK/l5sw0eN2dcSrIhGrNWURV+dUOUddW r8uG4zVHZ1HWwYq5V+RwuSNizFMa8nNTnfei5fArMYhcQ+HdImXeZ0NqIPhetnl9OKUX IsTRficT4AYXYTackHq9L3pJXoWdfLseyEIiicQROe73UIXlRoA67zS7PTyOPCdh+tsd /yLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=IVpjNOL5; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u62si2974681oib.201.2020.03.18.00.17.23; Wed, 18 Mar 2020 00:17:35 -0700 (PDT) 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=@broadcom.com header.s=google header.b=IVpjNOL5; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbgCRHRX (ORCPT + 99 others); Wed, 18 Mar 2020 03:17:23 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:43045 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726452AbgCRHRW (ORCPT ); Wed, 18 Mar 2020 03:17:22 -0400 Received: by mail-lf1-f65.google.com with SMTP id n20so16076724lfl.10 for ; Wed, 18 Mar 2020 00:17:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xFq8ZCIAoaagUUYPh3q+Bqojfoi/xwpn0FlUttraLqI=; b=IVpjNOL5Ix1cmD5w7cJvqO9HeI0jMMLCs5x43kjK32vaDHJDkQg3Ps2+VED8E6pnMo vQQehV3QqvRm5t5UOADUXLnPAMdfbzgjVSc/U35xp326TM5ZVdrAetCot2PDNIP9NQeT iseclkPBcsG+qTzeAIVmcx8BUv3mEANZrqAqE= 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=xFq8ZCIAoaagUUYPh3q+Bqojfoi/xwpn0FlUttraLqI=; b=QT2fvulCJKqrUgdWXPksV2D4sn1Go0Cxgm8SvDsqp1hocnmi/KM3+fO1vBC64B3Zhe 344bJN/eyIfrh9BhzHH6zT/2BgMmqbMFtwHvPGXhI9eB6AoFJ6HOEccdZwOEUre6Tio6 2GJF/MrV5pZxz5ycOB6PIc94pPp5Sw4sEx6Jz72Ag6KxyG8mlqT8VlfDqqxb5hdpq5ET rVjS3+7I6Dh/bI2f0fDUrz56JVC0uwR6xzjXChIKKzkK0zN/qx9nb8s6PEDCJOJTTK9X zCO70a/430lLKVvuLNdGEGenkqXs4uSKLktaUgmWRr1u18eB+SBpuD+wPXTX7QGErarE uXhw== X-Gm-Message-State: ANhLgQ1yNx5AjhtoTpRGis47xyiwp+01IyfcKhNiqYAIRG25XQtnomGT a9jso6RNZc5vxQp9cMsTerS1HFWho1dzLO4WaIJUdg== X-Received: by 2002:ac2:482f:: with SMTP id 15mr2004539lft.111.1584515841161; Wed, 18 Mar 2020 00:17:21 -0700 (PDT) MIME-Version: 1.0 References: <20200317061522.12685-1-rayagonda.kokatanur@broadcom.com> <20200317061522.12685-3-rayagonda.kokatanur@broadcom.com> In-Reply-To: From: Rayagonda Kokatanur Date: Wed, 18 Mar 2020 12:47:09 +0530 Message-ID: Subject: Re: [PATCH v1 2/2] async_tx: fix possible negative array indexing To: Dan Williams Cc: Herbert Xu , "David S . Miller" , Allison Randal , Kate Stewart , Thomas Gleixner , Greg Kroah-Hartman , linux-crypto , 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 Tue, Mar 17, 2020 at 11:06 PM Dan Williams wrote: > > On Mon, Mar 16, 2020 at 11:16 PM Rayagonda Kokatanur > wrote: > > > > Fix possible negative array index read in __2data_recov_5() function. > > > > Signed-off-by: Rayagonda Kokatanur > > --- > > crypto/async_tx/async_raid6_recov.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/crypto/async_tx/async_raid6_recov.c b/crypto/async_tx/async_raid6_recov.c > > index 33f2a8f8c9f4..9cd016cb2d09 100644 > > --- a/crypto/async_tx/async_raid6_recov.c > > +++ b/crypto/async_tx/async_raid6_recov.c > > @@ -206,7 +206,7 @@ __2data_recov_5(int disks, size_t bytes, int faila, int failb, > > good_srcs++; > > } > > > > - if (good_srcs > 1) > > + if ((good_srcs > 1) || (good < 0)) > > return NULL; > > Read the code again, I don't see how this can happen. This case can happen and it is reported by coverity tool. In the for loop , the condition "if (blocks[i] == NULL)" true all the time then variable 'good' will be -1.