Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10441979ybi; Wed, 24 Jul 2019 23:17:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9Gzi0Gym9zohvL0pm0ViAlh3p/Dv6KwWVO+yUddEb5ZFeWu2f3ytIF7OumQ/GYhDvmn+3 X-Received: by 2002:a17:902:2006:: with SMTP id n6mr91406711pla.232.1564035457544; Wed, 24 Jul 2019 23:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564035457; cv=none; d=google.com; s=arc-20160816; b=q516mWO4eDOZBgRfLOTTlFDlJjKZlL1zG/p/bEYg5R0l0+EwpDclPMuP1CqD4ep3e7 2nDGLkjPsr25vYMmBqnJ6f8fT7hfg6rDLXmkF4Wb58rG/26vv5XwHKoMM8tgrTd/2dTQ VR3F9VrrGOF74Qo2QDIuKaqnk5zuPEWb1MHtWJXn1+GrCW6UWFr9q9SVPPkLk1Hcided yVtta2kMSuOCkWL0J6JorBo8JuLtoSp00cbsfJzrCVQLMh/NNE16JRRYLCooc28yGCGk OcsngOQh4efwWzNqp+yaqohexbQGtN36AncmiK75KUT63WKCx/3t4VuxklJI1YiMmq5+ 8c+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ttU4eewplD7LZUUVLoXtzFnOtLUGTDfWxvCFxS6NchY=; b=gY6hBJAPQicgrYYXciKSY8vh51/qW3Ki/EbFq0tvNHruMeoBI5bz1IV+Kt+oC65FdO CKKZzecxZLBSkn+lO7zPC3P4fwgKP40LyP+f8zRLtvU70JYsbfTOdVtLVzkMQBlR+UAk kayrMoVgeTGgql+g7LDqnBdlCgHJVKULD2dkYKXswP8GKvWFacye1usdGi/yR78TOKCN QL34UXBgwz7tcWa1ek1/fTTqaiJhbd8UaFiQc83j6oqVRLF+uffbu6tpLyfyKvXjheBc qexCAdkezJUHw9cCXgR+gFx0dVdog7f4yhpKRYiP2/+IZmUCGptlJ1Y2ukSzO7sg5t0K df8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hddE4nEf; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si16412414plk.87.2019.07.24.23.17.22; Wed, 24 Jul 2019 23:17:37 -0700 (PDT) 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=@kernel.org header.s=default header.b=hddE4nEf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404127AbfGYFjl (ORCPT + 99 others); Thu, 25 Jul 2019 01:39:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:53882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404109AbfGYFjh (ORCPT ); Thu, 25 Jul 2019 01:39:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3874522BF3; Thu, 25 Jul 2019 05:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033176; bh=rxnY3wrfDDLzY2Euytksiym4+Ent8PQJYLcAuC5pEYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hddE4nEf2eOb1DQVYl70RpKg9hfr4nTKLuPL7QPFdXBbot6rpf31kdzzMssuuNTLw nMS6/2gbSfMnr8MWnQhLK7jrJtAapTntCG3d0wOXU4jdtSLiHL1o1q5OwgbabdUq6r Db8JIvyNG19B9f/sCpJS7zIYKOaitiuLJaLFPbRc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ferdinand Blomqvist , Thomas Gleixner , Sasha Levin Subject: [PATCH 4.19 117/271] rslib: Fix decoding of shortened codes Date: Wed, 24 Jul 2019 21:19:46 +0200 Message-Id: <20190724191705.277703963@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 2034a42d1747fc1e1eeef2c6f1789c4d0762cb9c ] The decoding of shortenend codes is broken. It only works as expected if there are no erasures. When decoding with erasures, Lambda (the error and erasure locator polynomial) is initialized from the given erasure positions. The pad parameter is not accounted for by the initialisation code, and hence Lambda is initialized from incorrect erasure positions. The fix is to adjust the erasure positions by the supplied pad. Signed-off-by: Ferdinand Blomqvist Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20190620141039.9874-3-ferdinand.blomqvist@gmail.com Signed-off-by: Sasha Levin --- lib/reed_solomon/decode_rs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index 1db74eb098d0..3313bf944ff1 100644 --- a/lib/reed_solomon/decode_rs.c +++ b/lib/reed_solomon/decode_rs.c @@ -99,9 +99,9 @@ if (no_eras > 0) { /* Init lambda to be the erasure locator polynomial */ lambda[1] = alpha_to[rs_modnn(rs, - prim * (nn - 1 - eras_pos[0]))]; + prim * (nn - 1 - (eras_pos[0] + pad)))]; for (i = 1; i < no_eras; i++) { - u = rs_modnn(rs, prim * (nn - 1 - eras_pos[i])); + u = rs_modnn(rs, prim * (nn - 1 - (eras_pos[i] + pad))); for (j = i + 1; j > 0; j--) { tmp = index_of[lambda[j - 1]]; if (tmp != nn) { -- 2.20.1