Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3820565ybi; Mon, 29 Jul 2019 13:16:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzNcMY15KZukDopMuj3b/ZKmLdZ82hRShLWJQPRNWHyQ2p9MaOyyOarhQNrpSfe2BWkJMO X-Received: by 2002:a65:64c5:: with SMTP id t5mr31903880pgv.168.1564431363188; Mon, 29 Jul 2019 13:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431363; cv=none; d=google.com; s=arc-20160816; b=QuerQ/ay4JLiVqU5oUdc9jfWVebGopsAJf+gyCb1Cx6Q9BCuj6MhSwaqf1qFC1f0Vy FRIAdZMSxKsgRI5moY7cju+TjhYJO65E9tjMl9Zq5rCGnyYedGxkb608VPe1FBHEcA1T OgR/36dk/EKSQieZYWPpJ4Zh2auhCurvIQfHQozzvJ0O8Cq7mTQO2LpTws8pLH/4qVQ+ YVqW4O6mfG7VhzCGhs2A5QcsitIVWTx1sm/PApjQJQZsEKlVglgCfddX5xbwwrmQDp/7 PewXtN91tbJPw2yLj9bOEdQ3sL1kG0+8AVR1Lt3ubrjupyn5mVe6/7ly1S/1IOhzM+f9 mQvA== 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=MSrt9Jg8EvsX3bErnhqtjjrt35YKIWEy/pfSSQ1zGZo=; b=FILIpOZj4BIGIOY//Jj7lm7A4obsOqphzKw/DcyYeVarUv7FzQL0OUyW74JA/S0IvH HxJEPBJpCFJXVKmW/zdox5HeeqLdpUBXdSqk3FgAo5RHtY3T9k5cjala2MAJ8xlzwqxk gkIfSh7sV/oZp1COXWsawIjUHC/7h7SsZVe/MrlrsgdWVjN7YTJ+wtFgXEAyzB/yglVP agIrLH3qGRAHgcxZ46qLe2UYna2+0bUsJ+/JO2qYsN/YG69rLN3sr/b8tuelhlA3MkOd Yc3KJI5G5An6PNdCvOJmfnoaR05veoAZXIq2CxuI52utFXmc02XzjFW7KfNsLmYkcRVI +hLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n5v4VLbU; 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 z1si28322350plb.41.2019.07.29.13.15.48; Mon, 29 Jul 2019 13:16:03 -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=n5v4VLbU; 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 S2388357AbfG2T1j (ORCPT + 99 others); Mon, 29 Jul 2019 15:27:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40227 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729929AbfG2T1h (ORCPT ); Mon, 29 Jul 2019 15:27: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 C38DA217D4; Mon, 29 Jul 2019 19:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428456; bh=dZpLJQa/iNeL7/6UDAIQwxGQuAixpVJtkTlR0A7g43s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n5v4VLbUzNRfJ9xXM/DBIYAGxEc91hO0s7oKZLpAPxk2DbzKmtTDnKCDuEd85pbGY yOr4Q9fB+FNO6K9Uh1tg0JEZQc1sEzPaOL6ZOWohPhylH10Ewp5oi9bAg6ai+3BGYu 0aKKjOZ9rbAL8sRrOaA30o3LoQ5zMjkriB6Wf3NI= 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.14 082/293] rslib: Fix decoding of shortened codes Date: Mon, 29 Jul 2019 21:19:33 +0200 Message-Id: <20190729190830.909403836@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 0ec3f257ffdf..8eed0f9ac495 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